webruby 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/lib/webruby/config.rb +4 -9
  3. data/lib/webruby/rake/files.rake +2 -2
  4. data/modules/emscripten/AUTHORS +9 -1
  5. data/modules/emscripten/CONTRIBUTING.markdown +5 -0
  6. data/modules/emscripten/ChangeLog +435 -0
  7. data/modules/emscripten/cmake/Modules/FindOpenAL.cmake +26 -0
  8. data/modules/emscripten/cmake/Platform/Emscripten.cmake +9 -2
  9. data/modules/emscripten/em++ +0 -2
  10. data/modules/emscripten/emcc +92 -32
  11. data/modules/emscripten/emlink.py +16 -13
  12. data/modules/emscripten/emmake +1 -1
  13. data/modules/emscripten/emrun +918 -0
  14. data/modules/emscripten/emrun.bat +2 -0
  15. data/modules/emscripten/emscripten.py +545 -20
  16. data/modules/emscripten/src/analyzer.js +6 -1
  17. data/modules/emscripten/src/compiler.js +25 -16
  18. data/modules/emscripten/src/emrun_postjs.js +20 -0
  19. data/modules/emscripten/{tests → src}/hello_world.js +0 -0
  20. data/modules/emscripten/src/intertyper.js +45 -16
  21. data/modules/emscripten/src/jsifier.js +78 -48
  22. data/modules/emscripten/src/library.js +381 -96
  23. data/modules/emscripten/src/library_browser.js +50 -53
  24. data/modules/emscripten/src/library_egl.js +66 -24
  25. data/modules/emscripten/src/library_fs.js +122 -90
  26. data/modules/emscripten/src/library_gl.js +739 -353
  27. data/modules/emscripten/src/library_glfw.js +9 -3
  28. data/modules/emscripten/src/library_glut.js +10 -5
  29. data/modules/emscripten/src/library_idbfs.js +14 -14
  30. data/modules/emscripten/src/library_memfs.js +65 -41
  31. data/modules/emscripten/src/library_nodefs.js +61 -9
  32. data/modules/emscripten/src/library_openal.js +4 -4
  33. data/modules/emscripten/src/library_path.js +9 -13
  34. data/modules/emscripten/src/library_sdl.js +301 -64
  35. data/modules/emscripten/src/library_sockfs.js +7 -5
  36. data/modules/emscripten/src/modules.js +62 -22
  37. data/modules/emscripten/src/parseTools.js +135 -102
  38. data/modules/emscripten/src/postamble.js +3 -4
  39. data/modules/emscripten/src/preamble.js +49 -29
  40. data/modules/emscripten/src/proxyClient.js +1 -1
  41. data/modules/emscripten/src/proxyWorker.js +10 -10
  42. data/modules/emscripten/src/relooper/Relooper.cpp +15 -4
  43. data/modules/emscripten/src/runtime.js +32 -8
  44. data/modules/emscripten/src/settings.js +25 -8
  45. data/modules/emscripten/src/shell.html +6 -3
  46. data/modules/emscripten/src/shell.js +13 -11
  47. data/modules/emscripten/src/simd.js +602 -432
  48. data/modules/emscripten/src/struct_info.json +22 -2
  49. data/modules/emscripten/src/utility.js +32 -17
  50. data/modules/emscripten/system/include/SDL/SDL_events.h +1 -0
  51. data/modules/emscripten/system/include/compat/ctype.h +17 -0
  52. data/modules/emscripten/system/include/compat/wchar.h +23 -0
  53. data/modules/emscripten/system/include/compat/wctype.h +23 -0
  54. data/modules/emscripten/system/include/emscripten/emmintrin.h +87 -0
  55. data/modules/emscripten/system/include/emscripten/emscripten.h +30 -4
  56. data/modules/emscripten/system/include/emscripten/vector.h +29 -1
  57. data/modules/emscripten/system/include/emscripten/xmmintrin.h +131 -0
  58. data/modules/emscripten/system/include/libcxx/CREDITS.TXT +9 -1
  59. data/modules/emscripten/system/include/libcxx/__bit_reference +8 -8
  60. data/modules/emscripten/system/include/libcxx/__config +95 -17
  61. data/modules/emscripten/system/include/libcxx/__debug +25 -4
  62. data/modules/emscripten/system/include/libcxx/__functional_03 +7 -7
  63. data/modules/emscripten/system/include/libcxx/__functional_base +169 -9
  64. data/modules/emscripten/system/include/libcxx/__functional_base_03 +1 -1
  65. data/modules/emscripten/system/include/libcxx/__hash_table +25 -25
  66. data/modules/emscripten/system/include/libcxx/__locale +21 -19
  67. data/modules/emscripten/system/include/libcxx/__mutex_base +2 -33
  68. data/modules/emscripten/system/include/libcxx/__split_buffer +9 -9
  69. data/modules/emscripten/system/include/libcxx/__std_stream +14 -0
  70. data/modules/emscripten/system/include/libcxx/__tree +35 -26
  71. data/modules/emscripten/system/include/libcxx/__tuple +15 -15
  72. data/modules/emscripten/system/include/libcxx/__tuple_03 +2 -2
  73. data/modules/emscripten/system/include/libcxx/__undef_min_max +8 -0
  74. data/modules/emscripten/system/include/libcxx/algorithm +121 -110
  75. data/modules/emscripten/system/include/libcxx/array +15 -15
  76. data/modules/emscripten/system/include/libcxx/bitset +4 -4
  77. data/modules/emscripten/system/include/libcxx/chrono +51 -17
  78. data/modules/emscripten/system/include/libcxx/cmath +25 -23
  79. data/modules/emscripten/system/include/libcxx/codecvt +21 -18
  80. data/modules/emscripten/system/include/libcxx/complex +48 -7
  81. data/modules/emscripten/system/include/libcxx/cstddef +1 -1
  82. data/modules/emscripten/system/include/libcxx/cstdio +8 -1
  83. data/modules/emscripten/system/include/libcxx/cstdlib +1 -1
  84. data/modules/emscripten/system/include/libcxx/cwchar +1 -1
  85. data/modules/emscripten/system/include/libcxx/deque +26 -12
  86. data/modules/emscripten/system/include/libcxx/dynarray +311 -0
  87. data/modules/emscripten/system/include/libcxx/exception +4 -4
  88. data/modules/emscripten/system/include/libcxx/ext/__hash +3 -3
  89. data/modules/emscripten/system/include/libcxx/ext/hash_map +19 -15
  90. data/modules/emscripten/system/include/libcxx/ext/hash_set +7 -3
  91. data/modules/emscripten/system/include/libcxx/forward_list +33 -7
  92. data/modules/emscripten/system/include/libcxx/fstream +4 -4
  93. data/modules/emscripten/system/include/libcxx/functional +200 -170
  94. data/modules/emscripten/system/include/libcxx/future +83 -39
  95. data/modules/emscripten/system/include/libcxx/initializer_list +24 -11
  96. data/modules/emscripten/system/include/libcxx/iomanip +147 -0
  97. data/modules/emscripten/system/include/libcxx/ios +24 -16
  98. data/modules/emscripten/system/include/libcxx/iosfwd +19 -19
  99. data/modules/emscripten/system/include/libcxx/istream +13 -8
  100. data/modules/emscripten/system/include/libcxx/iterator +108 -417
  101. data/modules/emscripten/system/include/libcxx/limits +8 -4
  102. data/modules/emscripten/system/include/libcxx/list +28 -8
  103. data/modules/emscripten/system/include/libcxx/locale +153 -390
  104. data/modules/emscripten/system/include/libcxx/map +280 -100
  105. data/modules/emscripten/system/include/libcxx/memory +49 -97
  106. data/modules/emscripten/system/include/libcxx/mutex +2 -2
  107. data/modules/emscripten/system/include/libcxx/new +43 -14
  108. data/modules/emscripten/system/include/libcxx/numeric +2 -2
  109. data/modules/emscripten/system/include/libcxx/optional +697 -0
  110. data/modules/emscripten/system/include/libcxx/ostream +17 -8
  111. data/modules/emscripten/system/include/libcxx/queue +5 -5
  112. data/modules/emscripten/system/include/libcxx/random +53 -51
  113. data/modules/emscripten/system/include/libcxx/ratio +11 -11
  114. data/modules/emscripten/system/include/libcxx/readme.txt +1 -1
  115. data/modules/emscripten/system/include/libcxx/regex +23 -20
  116. data/modules/emscripten/system/include/libcxx/scoped_allocator +1 -1
  117. data/modules/emscripten/system/include/libcxx/set +166 -2
  118. data/modules/emscripten/system/include/libcxx/shared_mutex +419 -0
  119. data/modules/emscripten/system/include/libcxx/sstream +4 -4
  120. data/modules/emscripten/system/include/libcxx/stack +3 -3
  121. data/modules/emscripten/system/include/libcxx/streambuf +5 -5
  122. data/modules/emscripten/system/include/libcxx/string +372 -324
  123. data/modules/emscripten/system/include/libcxx/support/ibm/limits.h +99 -0
  124. data/modules/emscripten/system/include/libcxx/support/ibm/support.h +54 -0
  125. data/modules/emscripten/system/include/libcxx/support/ibm/xlocale.h +326 -0
  126. data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +6 -6
  127. data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +15 -15
  128. data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +2 -0
  129. data/modules/emscripten/system/include/libcxx/support/win32/support.h +6 -1
  130. data/modules/emscripten/system/include/libcxx/system_error +14 -8
  131. data/modules/emscripten/system/include/libcxx/thread +7 -8
  132. data/modules/emscripten/system/include/libcxx/tuple +29 -88
  133. data/modules/emscripten/system/include/libcxx/type_traits +253 -209
  134. data/modules/emscripten/system/include/libcxx/typeindex +3 -3
  135. data/modules/emscripten/system/include/libcxx/unordered_map +162 -101
  136. data/modules/emscripten/system/include/libcxx/unordered_set +79 -2
  137. data/modules/emscripten/system/include/libcxx/utility +20 -20
  138. data/modules/emscripten/system/include/libcxx/valarray +23 -23
  139. data/modules/emscripten/system/include/libcxx/vector +114 -91
  140. data/modules/emscripten/system/lib/libc/musl/src/regex/regcomp.c +3352 -0
  141. data/modules/emscripten/system/lib/libc/musl/src/regex/regerror.c +35 -0
  142. data/modules/emscripten/system/lib/libc/musl/src/regex/regexec.c +1011 -0
  143. data/modules/emscripten/system/lib/libc/musl/src/regex/tre-mem.c +158 -0
  144. data/modules/emscripten/system/lib/libc/musl/src/regex/tre.h +231 -0
  145. data/modules/emscripten/system/lib/libcextra.symbols +7 -0
  146. data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +9 -1
  147. data/modules/emscripten/system/lib/libcxx/algorithm.cpp +1 -0
  148. data/modules/emscripten/system/lib/libcxx/debug.cpp +66 -42
  149. data/modules/emscripten/system/lib/libcxx/exception.cpp +88 -16
  150. data/modules/emscripten/system/lib/libcxx/future.cpp +6 -0
  151. data/modules/emscripten/system/lib/libcxx/ios.cpp +7 -2
  152. data/modules/emscripten/system/lib/libcxx/iostream.cpp +8 -8
  153. data/modules/emscripten/system/lib/libcxx/locale.cpp +38 -11
  154. data/modules/emscripten/system/lib/libcxx/mutex.cpp +3 -0
  155. data/modules/emscripten/system/lib/libcxx/new.cpp +44 -10
  156. data/modules/emscripten/system/lib/libcxx/optional.cpp +25 -0
  157. data/modules/emscripten/system/lib/libcxx/random.cpp +26 -0
  158. data/modules/emscripten/system/lib/libcxx/readme.txt +1 -1
  159. data/modules/emscripten/system/lib/libcxx/shared_mutex.cpp +101 -0
  160. data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +11 -7
  161. data/modules/emscripten/system/lib/libcxx/string.cpp +3 -1
  162. data/modules/emscripten/system/lib/libcxx/strstream.cpp +7 -7
  163. data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +12 -13
  164. data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +33 -36
  165. data/modules/emscripten/system/lib/libcxx/symbols +187 -168
  166. data/modules/emscripten/system/lib/libcxx/system_error.cpp +1 -0
  167. data/modules/emscripten/system/lib/libcxx/thread.cpp +7 -3
  168. data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +9 -6
  169. data/modules/emscripten/system/lib/libcxx/valarray.cpp +2 -0
  170. data/modules/emscripten/third_party/lzma.js/doit.bat +4 -0
  171. data/modules/emscripten/third_party/lzma.js/doit.sh +9 -2
  172. data/modules/emscripten/tools/cache.py +5 -7
  173. data/modules/emscripten/tools/cache.pyc +0 -0
  174. data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +7 -0
  175. data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +9 -1
  176. data/modules/emscripten/tools/eliminator/eliminator-test-output.js +3 -0
  177. data/modules/emscripten/tools/eliminator/eliminator-test.js +9 -1
  178. data/modules/emscripten/tools/file_packager.py +93 -50
  179. data/modules/emscripten/tools/js-optimizer.js +98 -48
  180. data/modules/emscripten/tools/js_optimizer.py +4 -4
  181. data/modules/emscripten/tools/js_optimizer.pyc +0 -0
  182. data/modules/emscripten/tools/jsrun.py +1 -1
  183. data/modules/emscripten/tools/jsrun.pyc +0 -0
  184. data/modules/emscripten/tools/response_file.py +6 -0
  185. data/modules/emscripten/tools/response_file.pyc +0 -0
  186. data/modules/emscripten/tools/settings_template_readonly.py +2 -0
  187. data/modules/emscripten/tools/shared.py +88 -34
  188. data/modules/emscripten/tools/shared.pyc +0 -0
  189. data/modules/emscripten/tools/split.py +21 -13
  190. data/modules/mruby/build_config.rb +7 -1
  191. data/modules/mruby/doc/compile/README.md +5 -9
  192. data/modules/mruby/include/mrbconf.h +5 -2
  193. data/modules/mruby/include/mruby/array.h +1 -0
  194. data/modules/mruby/include/mruby/compile.h +2 -4
  195. data/modules/mruby/include/mruby/dump.h +7 -16
  196. data/modules/mruby/include/mruby/hash.h +1 -1
  197. data/modules/mruby/include/mruby/irep.h +14 -2
  198. data/modules/mruby/include/mruby/khash.h +8 -7
  199. data/modules/mruby/include/mruby/string.h +1 -0
  200. data/modules/mruby/include/mruby/value.h +5 -2
  201. data/modules/mruby/include/mruby.h +12 -13
  202. data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +16 -6
  203. data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +18 -30
  204. data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +21 -0
  205. data/modules/mruby/mrbgems/mruby-math/src/math.c +1 -1
  206. data/modules/mruby/mrbgems/mruby-random/src/random.c +144 -47
  207. data/modules/mruby/mrbgems/mruby-random/test/random.rb +44 -0
  208. data/modules/mruby/mrbgems/mruby-struct/src/struct.c +5 -5
  209. data/modules/mruby/mrblib/numeric.rb +99 -33
  210. data/modules/mruby/src/array.c +11 -4
  211. data/modules/mruby/src/backtrace.c +2 -2
  212. data/modules/mruby/src/class.c +49 -30
  213. data/modules/mruby/src/codegen.c +131 -79
  214. data/modules/mruby/src/debug.c +1 -1
  215. data/modules/mruby/src/dump.c +213 -163
  216. data/modules/mruby/src/error.c +17 -17
  217. data/modules/mruby/src/error.h +1 -1
  218. data/modules/mruby/src/etc.c +10 -0
  219. data/modules/mruby/src/gc.c +35 -17
  220. data/modules/mruby/src/hash.c +5 -5
  221. data/modules/mruby/src/kernel.c +36 -14
  222. data/modules/mruby/src/load.c +238 -296
  223. data/modules/mruby/src/numeric.c +18 -98
  224. data/modules/mruby/src/object.c +3 -5
  225. data/modules/mruby/src/parse.y +63 -56
  226. data/modules/mruby/src/proc.c +8 -5
  227. data/modules/mruby/src/re.h +0 -1
  228. data/modules/mruby/src/state.c +65 -27
  229. data/modules/mruby/src/string.c +3 -31
  230. data/modules/mruby/src/symbol.c +3 -3
  231. data/modules/mruby/src/variable.c +12 -5
  232. data/modules/mruby/src/vm.c +90 -72
  233. data/modules/mruby/tasks/mruby_build.rake +10 -1
  234. data/modules/mruby/tasks/toolchains/gcc.rake +12 -2
  235. data/modules/mruby/tasks/toolchains/{vs2012.rake → visualcpp.rake} +1 -1
  236. data/modules/mruby/test/driver.c +3 -3
  237. data/modules/mruby/test/t/array.rb +5 -5
  238. data/modules/mruby/test/t/class.rb +14 -1
  239. data/modules/mruby/test/t/kernel.rb +4 -0
  240. data/modules/mruby/test/t/module.rb +4 -4
  241. data/modules/mruby/test/t/nameerror.rb +1 -1
  242. data/modules/mruby/tools/mrbc/mrbc.c +23 -17
  243. data/modules/mruby/travis_config.rb +10 -1
  244. metadata +28 -5
  245. data/modules/mruby/tasks/toolchains/vs2010.rake +0 -3
@@ -309,6 +309,19 @@ template <class C> auto end(const C& c) -> decltype(c.end());
309
309
  template <class T, size_t N> T* begin(T (&array)[N]);
310
310
  template <class T, size_t N> T* end(T (&array)[N]);
311
311
 
312
+ template <class C> auto cbegin(const C& c) -> decltype(std::begin(c)); // C++14
313
+ template <class C> auto cend(const C& c) -> decltype(std::end(c)); // C++14
314
+ template <class C> auto rbegin(C& c) -> decltype(c.rbegin()); // C++14
315
+ template <class C> auto rbegin(const C& c) -> decltype(c.rbegin()); // C++14
316
+ template <class C> auto rend(C& c) -> decltype(c.rend()); // C++14
317
+ template <class C> auto rend(const C& c) -> decltype(c.rend()); // C++14
318
+ template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14
319
+ template <class E> reverse_iterator<const E*> rend(initializer_list<E> il); // C++14
320
+ template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]); // C++14
321
+ template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]); // C++14
322
+ template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14
323
+ template <class C> auto crend(const C& c) -> decltype(std::rend(c)); // C++14
324
+
312
325
  } // std
313
326
 
314
327
  */
@@ -317,11 +330,12 @@ template <class T, size_t N> T* end(T (&array)[N]);
317
330
  #include <type_traits>
318
331
  #include <cstddef>
319
332
  #include <iosfwd>
333
+ #include <initializer_list>
320
334
  #ifdef __APPLE__
321
335
  #include <Availability.h>
322
336
  #endif
323
337
 
324
- #ifdef _LIBCPP_DEBUG2
338
+ #ifdef _LIBCPP_DEBUG
325
339
  # include <__debug>
326
340
  #else
327
341
  # define _LIBCPP_ASSERT(x, m) ((void)0)
@@ -333,11 +347,11 @@ template <class T, size_t N> T* end(T (&array)[N]);
333
347
 
334
348
  _LIBCPP_BEGIN_NAMESPACE_STD
335
349
 
336
- struct _LIBCPP_TYPE_VIS input_iterator_tag {};
337
- struct _LIBCPP_TYPE_VIS output_iterator_tag {};
338
- struct _LIBCPP_TYPE_VIS forward_iterator_tag : public input_iterator_tag {};
339
- struct _LIBCPP_TYPE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
340
- struct _LIBCPP_TYPE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
350
+ struct _LIBCPP_TYPE_VIS_ONLY input_iterator_tag {};
351
+ struct _LIBCPP_TYPE_VIS_ONLY output_iterator_tag {};
352
+ struct _LIBCPP_TYPE_VIS_ONLY forward_iterator_tag : public input_iterator_tag {};
353
+ struct _LIBCPP_TYPE_VIS_ONLY bidirectional_iterator_tag : public forward_iterator_tag {};
354
+ struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {};
341
355
 
342
356
  template <class _Tp>
343
357
  struct __has_iterator_category
@@ -380,11 +394,11 @@ struct __iterator_traits<_Iter, true>
380
394
  // the client expects instead of failing at compile time.
381
395
 
382
396
  template <class _Iter>
383
- struct _LIBCPP_TYPE_VIS iterator_traits
397
+ struct _LIBCPP_TYPE_VIS_ONLY iterator_traits
384
398
  : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
385
399
 
386
400
  template<class _Tp>
387
- struct _LIBCPP_TYPE_VIS iterator_traits<_Tp*>
401
+ struct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*>
388
402
  {
389
403
  typedef ptrdiff_t difference_type;
390
404
  typedef typename remove_const<_Tp>::type value_type;
@@ -415,7 +429,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
415
429
 
416
430
  template<class _Category, class _Tp, class _Distance = ptrdiff_t,
417
431
  class _Pointer = _Tp*, class _Reference = _Tp&>
418
- struct _LIBCPP_TYPE_VIS iterator
432
+ struct _LIBCPP_TYPE_VIS_ONLY iterator
419
433
  {
420
434
  typedef _Tp value_type;
421
435
  typedef _Distance difference_type;
@@ -512,7 +526,7 @@ prev(_BidiretionalIter __x,
512
526
  }
513
527
 
514
528
  template <class _Iter>
515
- class _LIBCPP_TYPE_VIS reverse_iterator
529
+ class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
516
530
  : public iterator<typename iterator_traits<_Iter>::iterator_category,
517
531
  typename iterator_traits<_Iter>::value_type,
518
532
  typename iterator_traits<_Iter>::difference_type,
@@ -619,7 +633,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
619
633
  }
620
634
 
621
635
  template <class _Container>
622
- class _LIBCPP_TYPE_VIS back_insert_iterator
636
+ class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator
623
637
  : public iterator<output_iterator_tag,
624
638
  void,
625
639
  void,
@@ -652,7 +666,7 @@ back_inserter(_Container& __x)
652
666
  }
653
667
 
654
668
  template <class _Container>
655
- class _LIBCPP_TYPE_VIS front_insert_iterator
669
+ class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator
656
670
  : public iterator<output_iterator_tag,
657
671
  void,
658
672
  void,
@@ -685,7 +699,7 @@ front_inserter(_Container& __x)
685
699
  }
686
700
 
687
701
  template <class _Container>
688
- class _LIBCPP_TYPE_VIS insert_iterator
702
+ class _LIBCPP_TYPE_VIS_ONLY insert_iterator
689
703
  : public iterator<output_iterator_tag,
690
704
  void,
691
705
  void,
@@ -721,7 +735,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
721
735
 
722
736
  template <class _Tp, class _CharT = char,
723
737
  class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
724
- class _LIBCPP_TYPE_VIS istream_iterator
738
+ class _LIBCPP_TYPE_VIS_ONLY istream_iterator
725
739
  : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
726
740
  {
727
741
  public:
@@ -760,7 +774,7 @@ public:
760
774
  };
761
775
 
762
776
  template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
763
- class _LIBCPP_TYPE_VIS ostream_iterator
777
+ class _LIBCPP_TYPE_VIS_ONLY ostream_iterator
764
778
  : public iterator<output_iterator_tag, void, void, void, void>
765
779
  {
766
780
  public:
@@ -789,7 +803,7 @@ public:
789
803
  };
790
804
 
791
805
  template<class _CharT, class _Traits>
792
- class _LIBCPP_TYPE_VIS istreambuf_iterator
806
+ class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator
793
807
  : public iterator<input_iterator_tag, _CharT,
794
808
  typename _Traits::off_type, _CharT*,
795
809
  _CharT>
@@ -860,7 +874,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
860
874
  {return !__a.equal(__b);}
861
875
 
862
876
  template <class _CharT, class _Traits>
863
- class _LIBCPP_TYPE_VIS ostreambuf_iterator
877
+ class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator
864
878
  : public iterator<output_iterator_tag, void, void, void, void>
865
879
  {
866
880
  public:
@@ -901,7 +915,7 @@ public:
901
915
  };
902
916
 
903
917
  template <class _Iter>
904
- class _LIBCPP_TYPE_VIS move_iterator
918
+ class _LIBCPP_TYPE_VIS_ONLY move_iterator
905
919
  {
906
920
  private:
907
921
  _Iter __i;
@@ -1016,7 +1030,7 @@ operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterato
1016
1030
  template <class _Iter>
1017
1031
  inline _LIBCPP_INLINE_VISIBILITY
1018
1032
  move_iterator<_Iter>
1019
- make_move_iterator(const _Iter& __i)
1033
+ make_move_iterator(_Iter __i)
1020
1034
  {
1021
1035
  return move_iterator<_Iter>(__i);
1022
1036
  }
@@ -1197,12 +1211,13 @@ public:
1197
1211
  _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
1198
1212
 
1199
1213
  private:
1200
- _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
1201
1214
  #if _LIBCPP_DEBUG_LEVEL >= 2
1202
1215
  _LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
1203
1216
  {
1204
1217
  __get_db()->__insert_ic(this, __p);
1205
1218
  }
1219
+ #else
1220
+ _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
1206
1221
  #endif
1207
1222
 
1208
1223
  template <class _Up> friend class __wrap_iter;
@@ -1370,456 +1385,101 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
1370
1385
  return __x;
1371
1386
  }
1372
1387
 
1373
- #ifdef _LIBCPP_DEBUG
1374
-
1375
- // __debug_iter
1376
-
1377
- template <class _Container, class _Iter> class __debug_iter;
1378
-
1379
- template <class _Container, class _Iter1, class _Iter2>
1380
- _LIBCPP_INLINE_VISIBILITY
1381
- bool
1382
- operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1383
-
1384
- template <class _Container, class _Iter1, class _Iter2>
1385
- _LIBCPP_INLINE_VISIBILITY
1386
- bool
1387
- operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1388
-
1389
- template <class _Container, class _Iter1, class _Iter2>
1390
- _LIBCPP_INLINE_VISIBILITY
1391
- bool
1392
- operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1393
-
1394
- template <class _Container, class _Iter1, class _Iter2>
1395
- _LIBCPP_INLINE_VISIBILITY
1396
- bool
1397
- operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1398
-
1399
- template <class _Container, class _Iter1, class _Iter2>
1400
- _LIBCPP_INLINE_VISIBILITY
1401
- bool
1402
- operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1403
-
1404
- template <class _Container, class _Iter1, class _Iter2>
1405
- _LIBCPP_INLINE_VISIBILITY
1406
- bool
1407
- operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1408
-
1409
- template <class _Container, class _Iter1, class _Iter2>
1410
- _LIBCPP_INLINE_VISIBILITY
1411
- typename __debug_iter<_Container, _Iter1>::difference_type
1412
- operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
1413
-
1414
- template <class _Container, class _Iter>
1415
- _LIBCPP_INLINE_VISIBILITY
1416
- __debug_iter<_Container, _Iter>
1417
- operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
1418
-
1419
- template <class _Container, class _Iter>
1420
- class __debug_iter
1421
- {
1422
- public:
1423
- typedef _Iter iterator_type;
1424
- typedef _Container __container_type;
1425
- typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
1426
- typedef typename iterator_traits<iterator_type>::value_type value_type;
1427
- typedef typename iterator_traits<iterator_type>::difference_type difference_type;
1428
- typedef typename iterator_traits<iterator_type>::pointer pointer;
1429
- typedef typename iterator_traits<iterator_type>::reference reference;
1430
- private:
1431
- iterator_type __i;
1432
- __debug_iter* __next;
1433
- __container_type* __cont;
1434
-
1435
- public:
1436
- _LIBCPP_INLINE_VISIBILITY __debug_iter() : __next(0), __cont(0) {}
1437
- _LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter& __x)
1438
- : __i(__x.base()), __next(0), __cont(0) {__set_owner(__x.__cont);}
1439
- __debug_iter& operator=(const __debug_iter& __x);
1440
- template <class _Up> _LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter<_Container, _Up>& __u,
1441
- typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0)
1442
- : __i(__u.base()), __next(0), __cont(0) {__set_owner(__u.__cont);}
1443
- _LIBCPP_INLINE_VISIBILITY ~__debug_iter() {__remove_owner();}
1444
- _LIBCPP_INLINE_VISIBILITY reference operator*() const {assert(__is_deref()); return *__i;}
1445
- _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
1446
- _LIBCPP_INLINE_VISIBILITY __debug_iter& operator++() {assert(__can_increment()); ++__i; return *this;}
1447
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator++(int)
1448
- {__debug_iter __tmp(*this); operator++(); return __tmp;}
1449
- _LIBCPP_INLINE_VISIBILITY __debug_iter& operator--() {assert(__can_decrement()); --__i; return *this;}
1450
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator--(int)
1451
- {__debug_iter __tmp(*this); operator--(); return __tmp;}
1452
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator+ (difference_type __n) const
1453
- {__debug_iter __t(*this); __t += __n; return __t;}
1454
- __debug_iter& operator+=(difference_type __n);
1455
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator- (difference_type __n) const
1456
- {__debug_iter __t(*this); __t -= __n; return __t;}
1457
- _LIBCPP_INLINE_VISIBILITY __debug_iter& operator-=(difference_type __n)
1458
- {*this += -__n; return *this;}
1459
- _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
1460
- {return *(*this + __n);}
1461
-
1462
- private:
1463
- _LIBCPP_INLINE_VISIBILITY __debug_iter(const __container_type* __c, iterator_type __x)
1464
- : __i(__x), __next(0), __cont(0) {__set_owner(__c);}
1465
- _LIBCPP_INLINE_VISIBILITY iterator_type base() const {return __i;}
1466
-
1467
- void __set_owner(const __container_type* __c);
1468
- void __remove_owner();
1469
- static void __remove_all(__container_type* __c);
1470
- static void swap(__container_type* __x, __container_type* __y);
1471
-
1472
- _LIBCPP_INLINE_VISIBILITY bool __is_deref() const
1473
- {return __is_deref(__is_random_access_iterator<iterator_type>());}
1474
- bool __is_deref(false_type) const;
1475
- bool __is_deref(true_type) const;
1476
- _LIBCPP_INLINE_VISIBILITY bool __can_decrement() const
1477
- {return __can_decrement(integral_constant<int, is_pointer<iterator_type>::value ? 2:
1478
- __is_random_access_iterator<iterator_type>::value ? 1 : 0>());}
1479
- bool __can_decrement(integral_constant<int, 0>) const;
1480
- bool __can_decrement(integral_constant<int, 1>) const;
1481
- bool __can_decrement(integral_constant<int, 2>) const;
1482
- _LIBCPP_INLINE_VISIBILITY bool __can_increment() const
1483
- {return __can_increment(integral_constant<int, is_pointer<iterator_type>::value ? 2:
1484
- __is_random_access_iterator<iterator_type>::value ? 1 : 0>());}
1485
- bool __can_increment(integral_constant<int, 0>) const;
1486
- bool __can_increment(integral_constant<int, 1>) const;
1487
- bool __can_increment(integral_constant<int, 2>) const;
1488
-
1489
- _LIBCPP_INLINE_VISIBILITY bool __can_add(difference_type __n) const
1490
- {return __can_add(__n, is_pointer<iterator_type>());}
1491
- bool __can_add(difference_type __n, false_type) const;
1492
- bool __can_add(difference_type __n, true_type) const;
1493
-
1494
- template <class _Cp, class _Up> friend class __debug_iter;
1495
- friend class _Container::__self;
1496
-
1497
- template <class _Cp, class _Iter1, class _Iter2>
1498
- friend
1499
- bool
1500
- operator==(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1501
-
1502
- template <class _Cp, class _Iter1, class _Iter2>
1503
- friend
1504
- bool
1505
- operator<(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1506
-
1507
- template <class _Cp, class _Iter1, class _Iter2>
1508
- friend
1509
- bool
1510
- operator!=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1511
-
1512
- template <class _Cp, class _Iter1, class _Iter2>
1513
- friend
1514
- bool
1515
- operator>(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1516
-
1517
- template <class _Cp, class _Iter1, class _Iter2>
1518
- friend
1519
- bool
1520
- operator>=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1521
-
1522
- template <class _Cp, class _Iter1, class _Iter2>
1523
- friend
1524
- bool
1525
- operator<=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1526
-
1527
- template <class _Cp, class _Iter1, class _Iter2>
1528
- friend
1529
- typename __debug_iter<_Cp, _Iter1>::difference_type
1530
- operator-(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
1531
-
1532
- template <class _Cp, class _Iter1>
1533
- friend
1534
- __debug_iter<_Cp, _Iter1>
1535
- operator+(typename __debug_iter<_Cp, _Iter1>::difference_type, const __debug_iter<_Cp, _Iter1>&);
1536
- };
1537
-
1538
- template <class _Container, class _Iter>
1539
- __debug_iter<_Container, _Iter>&
1540
- __debug_iter<_Container, _Iter>::operator=(const __debug_iter& __x)
1541
- {
1542
- if (this != &__x)
1543
- {
1544
- __remove_owner();
1545
- __i = __x.__i;
1546
- __set_owner(__x.__cont);
1547
- }
1548
- return *this;
1549
- }
1550
-
1551
- template <class _Container, class _Iter>
1552
- void
1553
- __debug_iter<_Container, _Iter>::__set_owner(const __container_type* __c)
1554
- {
1555
- __cont = const_cast<__container_type*>(__c);
1556
- __debug_iter*& __head = __cont->__get_iterator_list(this);
1557
- __next = __head;
1558
- __head = this;
1559
- }
1560
-
1561
- template <class _Container, class _Iter>
1562
- void
1563
- __debug_iter<_Container, _Iter>::__remove_owner()
1564
- {
1565
- if (__cont)
1566
- {
1567
- __debug_iter*& __head = __cont->__get_iterator_list(this);
1568
- if (__head == this)
1569
- __head = __next;
1570
- else
1571
- {
1572
- __debug_iter* __prev = __head;
1573
- for (__debug_iter* __p = __head->__next; __p != this; __p = __p->__next)
1574
- __prev = __p;
1575
- __prev->__next = __next;
1576
- }
1577
- __cont = 0;
1578
- }
1579
- }
1580
-
1581
- template <class _Container, class _Iter>
1582
- void
1583
- __debug_iter<_Container, _Iter>::__remove_all(__container_type* __c)
1584
- {
1585
- __debug_iter*& __head = __c->__get_iterator_list((__debug_iter*)0);
1586
- __debug_iter* __p = __head;
1587
- __head = 0;
1588
- while (__p)
1589
- {
1590
- __p->__cont = 0;
1591
- __debug_iter* __n = __p->__next;
1592
- __p->__next = 0;
1593
- __p = __n;
1594
- }
1595
- }
1596
-
1597
- template <class _Container, class _Iter>
1598
- void
1599
- __debug_iter<_Container, _Iter>::swap(__container_type* __x, __container_type* __y)
1600
- {
1601
- __debug_iter*& __head_x = __x->__get_iterator_list((__debug_iter*)0);
1602
- __debug_iter*& __head_y = __y->__get_iterator_list((__debug_iter*)0);
1603
- __debug_iter* __p = __head_x;
1604
- __head_x = __head_y;
1605
- __head_y = __p;
1606
- for (__p = __head_x; __p; __p = __p->__next)
1607
- __p->__cont = __x;
1608
- for (__p = __head_y; __p; __p = __p->__next)
1609
- __p->__cont = __y;
1610
- }
1611
-
1612
- template <class _Container, class _Iter>
1613
- bool
1614
- __debug_iter<_Container, _Iter>::__is_deref(false_type) const
1615
- {
1616
- if (__cont == 0)
1617
- return false;
1618
- return __i != __cont->end().base();
1619
- }
1620
-
1621
- template <class _Container, class _Iter>
1622
- bool
1623
- __debug_iter<_Container, _Iter>::__is_deref(true_type) const
1624
- {
1625
- if (__cont == 0)
1626
- return false;
1627
- return __i < __cont->end().base();
1628
- }
1629
-
1630
- template <class _Container, class _Iter>
1631
- bool
1632
- __debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 0>) const
1633
- {
1634
- if (__cont == 0)
1635
- return false;
1636
- return __i != __cont->begin().base();
1637
- }
1638
-
1639
- template <class _Container, class _Iter>
1640
- bool
1641
- __debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 1>) const
1642
- {
1643
- if (__cont == 0)
1644
- return false;
1645
- iterator_type __b = __cont->begin().base();
1646
- return __b < __i && __i <= __b + __cont->size();
1647
- }
1648
-
1649
- template <class _Container, class _Iter>
1650
- bool
1651
- __debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 2>) const
1652
- {
1653
- if (__cont == 0)
1654
- return false;
1655
- iterator_type __b = __cont->begin().base();
1656
- return __b < __i && __i <= __b + __cont->size();
1657
- }
1658
-
1659
- template <class _Container, class _Iter>
1660
- bool
1661
- __debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 0>) const
1662
- {
1663
- if (__cont == 0)
1664
- return false;
1665
- return __i != __cont->end().base();
1666
- }
1667
-
1668
- template <class _Container, class _Iter>
1669
- bool
1670
- __debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 1>) const
1671
- {
1672
- if (__cont == 0)
1673
- return false;
1674
- iterator_type __b = __cont->begin().base();
1675
- return __b <= __i && __i < __b + __cont->size();
1676
- }
1677
-
1678
- template <class _Container, class _Iter>
1679
- bool
1680
- __debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 2>) const
1681
- {
1682
- if (__cont == 0)
1683
- return false;
1684
- iterator_type __b = __cont->begin().base();
1685
- return __b <= __i && __i < __b + __cont->size();
1686
- }
1687
-
1688
- template <class _Container, class _Iter>
1689
- bool
1690
- __debug_iter<_Container, _Iter>::__can_add(difference_type __n, false_type) const
1691
- {
1692
- if (__cont == 0)
1693
- return false;
1694
- iterator_type __b = __cont->begin().base();
1695
- iterator_type __j = __i + __n;
1696
- return __b <= __j && __j <= __b + __cont->size();
1697
- }
1698
-
1699
- template <class _Container, class _Iter>
1700
- bool
1701
- __debug_iter<_Container, _Iter>::__can_add(difference_type __n, true_type) const
1702
- {
1703
- if (__cont == 0)
1704
- return false;
1705
- iterator_type __b = __cont->begin().base();
1706
- iterator_type __j = __i + __n;
1707
- return __b <= __j && __j <= __b + __cont->size();
1708
- }
1709
-
1710
- template <class _Container, class _Iter>
1711
- __debug_iter<_Container, _Iter>&
1712
- __debug_iter<_Container, _Iter>::operator+=(difference_type __n)
1713
- {
1714
- assert(__can_add(__n));
1715
- __i += __n;
1716
- return *this;
1717
- }
1388
+ #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
1718
1389
 
1719
- template <class _Container, class _Iter1, class _Iter2>
1390
+ template <class _Cp>
1720
1391
  inline _LIBCPP_INLINE_VISIBILITY
1721
- bool
1722
- operator==(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1392
+ auto
1393
+ begin(_Cp& __c) -> decltype(__c.begin())
1723
1394
  {
1724
- assert(__x.__cont && __x.__cont == __y.__cont);
1725
- return __x.base() == __y.base();
1395
+ return __c.begin();
1726
1396
  }
1727
1397
 
1728
- template <class _Container, class _Iter1, class _Iter2>
1398
+ template <class _Cp>
1729
1399
  inline _LIBCPP_INLINE_VISIBILITY
1730
- bool
1731
- operator!=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1400
+ auto
1401
+ begin(const _Cp& __c) -> decltype(__c.begin())
1732
1402
  {
1733
- return !(__x == __y);
1403
+ return __c.begin();
1734
1404
  }
1735
1405
 
1736
- template <class _Container, class _Iter1, class _Iter2>
1406
+ template <class _Cp>
1737
1407
  inline _LIBCPP_INLINE_VISIBILITY
1738
- bool
1739
- operator<(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1408
+ auto
1409
+ end(_Cp& __c) -> decltype(__c.end())
1740
1410
  {
1741
- assert(__x.__cont && __x.__cont == __y.__cont);
1742
- return __x.base() < __y.base();
1411
+ return __c.end();
1743
1412
  }
1744
1413
 
1745
- template <class _Container, class _Iter1, class _Iter2>
1414
+ template <class _Cp>
1746
1415
  inline _LIBCPP_INLINE_VISIBILITY
1747
- bool
1748
- operator>(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1416
+ auto
1417
+ end(const _Cp& __c) -> decltype(__c.end())
1749
1418
  {
1750
- return __y < __x;
1419
+ return __c.end();
1751
1420
  }
1752
1421
 
1753
- template <class _Container, class _Iter1, class _Iter2>
1422
+ #if _LIBCPP_STD_VER > 11
1423
+
1424
+ template <class _Cp>
1754
1425
  inline _LIBCPP_INLINE_VISIBILITY
1755
- bool
1756
- operator>=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1426
+ auto cbegin(const _Cp& __c) -> decltype(begin(__c))
1757
1427
  {
1758
- return !(__x < __y);
1428
+ return __c.begin();
1759
1429
  }
1760
1430
 
1761
- template <class _Container, class _Iter1, class _Iter2>
1431
+ template <class _Cp>
1762
1432
  inline _LIBCPP_INLINE_VISIBILITY
1763
- bool
1764
- operator<=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1433
+ auto cend(const _Cp& __c) -> decltype(end(__c))
1765
1434
  {
1766
- return !(__y < __x);
1435
+ return __c.end();
1767
1436
  }
1768
1437
 
1769
- template <class _Container, class _Iter1, class _Iter2>
1438
+ template <class _Cp>
1770
1439
  inline _LIBCPP_INLINE_VISIBILITY
1771
- typename __debug_iter<_Container, _Iter1>::difference_type
1772
- operator-(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
1440
+ auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
1773
1441
  {
1774
- assert(__x.__cont && __x.__cont == __y.__cont);
1775
- return __x.base() - __y.base();
1442
+ return __c.rbegin();
1776
1443
  }
1777
1444
 
1778
- template <class _Container, class _Iter>
1445
+ template <class _Cp>
1779
1446
  inline _LIBCPP_INLINE_VISIBILITY
1780
- __debug_iter<_Container, _Iter>
1781
- operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
1782
- const __debug_iter<_Container, _Iter>& __x)
1447
+ auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
1783
1448
  {
1784
- return __x + __n;
1449
+ return __c.rbegin();
1785
1450
  }
1786
1451
 
1787
- #endif // _LIBCPP_DEBUG
1788
-
1789
- #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
1790
-
1791
1452
  template <class _Cp>
1792
1453
  inline _LIBCPP_INLINE_VISIBILITY
1793
- auto
1794
- begin(_Cp& __c) -> decltype(__c.begin())
1454
+ auto rend(_Cp& __c) -> decltype(__c.rend())
1795
1455
  {
1796
- return __c.begin();
1456
+ return __c.rend();
1797
1457
  }
1798
1458
 
1799
1459
  template <class _Cp>
1800
1460
  inline _LIBCPP_INLINE_VISIBILITY
1801
- auto
1802
- begin(const _Cp& __c) -> decltype(__c.begin())
1461
+ auto rend(const _Cp& __c) -> decltype(__c.rend())
1803
1462
  {
1804
- return __c.begin();
1463
+ return __c.rend();
1805
1464
  }
1806
1465
 
1807
1466
  template <class _Cp>
1808
1467
  inline _LIBCPP_INLINE_VISIBILITY
1809
- auto
1810
- end(_Cp& __c) -> decltype(__c.end())
1468
+ auto crbegin(const _Cp& __c) -> decltype(rbegin(__c))
1811
1469
  {
1812
- return __c.end();
1470
+ return rbegin(__c);
1813
1471
  }
1814
1472
 
1815
1473
  template <class _Cp>
1816
1474
  inline _LIBCPP_INLINE_VISIBILITY
1817
- auto
1818
- end(const _Cp& __c) -> decltype(__c.end())
1475
+ auto crend(const _Cp& __c) -> decltype(rend(__c))
1819
1476
  {
1820
- return __c.end();
1477
+ return rend(__c);
1821
1478
  }
1822
1479
 
1480
+ #endif
1481
+
1482
+
1823
1483
  #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
1824
1484
 
1825
1485
  template <class _Cp>
@@ -1872,6 +1532,37 @@ end(_Tp (&__array)[_Np])
1872
1532
  return __array + _Np;
1873
1533
  }
1874
1534
 
1535
+ #if _LIBCPP_STD_VER > 11
1536
+ template <class _Tp, size_t _Np>
1537
+ inline _LIBCPP_INLINE_VISIBILITY
1538
+ reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
1539
+ {
1540
+ return reverse_iterator<_Tp*>(__array + _Np);
1541
+ }
1542
+
1543
+ template <class _Tp, size_t _Np>
1544
+ inline _LIBCPP_INLINE_VISIBILITY
1545
+ reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
1546
+ {
1547
+ return reverse_iterator<_Tp*>(__array);
1548
+ }
1549
+
1550
+ template <class _Ep>
1551
+ inline _LIBCPP_INLINE_VISIBILITY
1552
+ reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
1553
+ {
1554
+ return reverse_iterator<const _Ep*>(__il.end());
1555
+ }
1556
+
1557
+ template <class _Ep>
1558
+ inline _LIBCPP_INLINE_VISIBILITY
1559
+ reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
1560
+ {
1561
+ return reverse_iterator<const _Ep*>(__il.begin());
1562
+ }
1563
+
1564
+ #endif
1565
+
1875
1566
  _LIBCPP_END_NAMESPACE_STD
1876
1567
 
1877
1568
  #endif // _LIBCPP_ITERATOR