webruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1364) hide show
  1. checksums.yaml +7 -0
  2. data/bin/webruby +36 -0
  3. data/driver/driver.c +50 -0
  4. data/driver/main.c +40 -0
  5. data/lib/webruby/app.rb +13 -0
  6. data/lib/webruby/config.rb +61 -0
  7. data/lib/webruby/environment.rb +32 -0
  8. data/lib/webruby/rake/files.rake +66 -0
  9. data/lib/webruby/rake/general.rake +22 -0
  10. data/lib/webruby/rake/mruby.rake +44 -0
  11. data/lib/webruby/utility.rb +132 -0
  12. data/lib/webruby.rb +10 -0
  13. data/modules/emscripten/AUTHORS +89 -0
  14. data/modules/emscripten/LICENSE +68 -0
  15. data/modules/emscripten/README.markdown +14 -0
  16. data/modules/emscripten/cmake/Platform/Emscripten.cmake +61 -0
  17. data/modules/emscripten/cmake/Platform/Emscripten_unix.cmake +24 -0
  18. data/modules/emscripten/em++ +12 -0
  19. data/modules/emscripten/em++.bat +2 -0
  20. data/modules/emscripten/em-config +24 -0
  21. data/modules/emscripten/em-config.bat +2 -0
  22. data/modules/emscripten/emar +24 -0
  23. data/modules/emscripten/emar.bat +2 -0
  24. data/modules/emscripten/emcc +1744 -0
  25. data/modules/emscripten/emcc.bat +2 -0
  26. data/modules/emscripten/emcc.py +5 -0
  27. data/modules/emscripten/emconfigure +27 -0
  28. data/modules/emscripten/emconfigure.bat +2 -0
  29. data/modules/emscripten/emlibtool +11 -0
  30. data/modules/emscripten/emlibtool.bat +2 -0
  31. data/modules/emscripten/emlink.py +293 -0
  32. data/modules/emscripten/emmake +29 -0
  33. data/modules/emscripten/emmake.bat +2 -0
  34. data/modules/emscripten/emranlib +9 -0
  35. data/modules/emscripten/emranlib.bat +2 -0
  36. data/modules/emscripten/emscons +20 -0
  37. data/modules/emscripten/emscripten.py +835 -0
  38. data/modules/emscripten/patches/README +4 -0
  39. data/modules/emscripten/patches/series +2 -0
  40. data/modules/emscripten/scons-tools/closure.py +28 -0
  41. data/modules/emscripten/scons-tools/emscripten.py +359 -0
  42. data/modules/emscripten/scons-tools/llvm.py +33 -0
  43. data/modules/emscripten/src/analyzer.js +1695 -0
  44. data/modules/emscripten/src/compiler.html +48 -0
  45. data/modules/emscripten/src/compiler.js +298 -0
  46. data/modules/emscripten/src/corruptionCheck.js +98 -0
  47. data/modules/emscripten/src/determinstic.js +20 -0
  48. data/modules/emscripten/src/embind/embind.js +1677 -0
  49. data/modules/emscripten/src/embind/emval.js +283 -0
  50. data/modules/emscripten/src/experimental/allow_loopvars_from_memsetcpy_inasm.diff +97 -0
  51. data/modules/emscripten/src/experimental/batching.diff +44 -0
  52. data/modules/emscripten/src/experimental/functypeopt.diff +113 -0
  53. data/modules/emscripten/src/experimental/multiple_heaps.diff +175 -0
  54. data/modules/emscripten/src/experimental/noncallgraphprofiling.diff +197 -0
  55. data/modules/emscripten/src/experimental/optimize_memcpy_for_ta1.diff +124 -0
  56. data/modules/emscripten/src/experimental/remove__label__s.diff +140 -0
  57. data/modules/emscripten/src/experimental/renderer_cache_hash.diff +99 -0
  58. data/modules/emscripten/src/experimental/sdl_key_forwarding.diff +57 -0
  59. data/modules/emscripten/src/experimental/simplifyGeneratedFunctionsDetection.diff +336 -0
  60. data/modules/emscripten/src/experimental/stringCache.diff +147 -0
  61. data/modules/emscripten/src/fastLong.js +299 -0
  62. data/modules/emscripten/src/framework.js +257 -0
  63. data/modules/emscripten/src/gl-matrix.js +1952 -0
  64. data/modules/emscripten/src/headless.js +904 -0
  65. data/modules/emscripten/src/intertyper.js +1050 -0
  66. data/modules/emscripten/src/jsifier.js +1827 -0
  67. data/modules/emscripten/src/library.js +8270 -0
  68. data/modules/emscripten/src/library_browser.js +911 -0
  69. data/modules/emscripten/src/library_egl.js +491 -0
  70. data/modules/emscripten/src/library_gc.js +236 -0
  71. data/modules/emscripten/src/library_gl.js +4452 -0
  72. data/modules/emscripten/src/library_glfw.js +576 -0
  73. data/modules/emscripten/src/library_glut.js +449 -0
  74. data/modules/emscripten/src/library_jansson.js +320 -0
  75. data/modules/emscripten/src/library_openal.js +602 -0
  76. data/modules/emscripten/src/library_sdl.js +2024 -0
  77. data/modules/emscripten/src/library_strtok_r.c +97 -0
  78. data/modules/emscripten/src/library_xlib.js +23 -0
  79. data/modules/emscripten/src/long.js +1609 -0
  80. data/modules/emscripten/src/modules.js +491 -0
  81. data/modules/emscripten/src/parseTools.js +2474 -0
  82. data/modules/emscripten/src/postamble.js +170 -0
  83. data/modules/emscripten/src/postamble_sharedlib.js +16 -0
  84. data/modules/emscripten/src/preamble.js +914 -0
  85. data/modules/emscripten/src/preamble_sharedlib.js +25 -0
  86. data/modules/emscripten/src/relooper/README.markdown +14 -0
  87. data/modules/emscripten/src/relooper/Relooper.cpp +1236 -0
  88. data/modules/emscripten/src/relooper/Relooper.h +250 -0
  89. data/modules/emscripten/src/relooper/doit.sh +70 -0
  90. data/modules/emscripten/src/relooper/emscripten/glue.js +57 -0
  91. data/modules/emscripten/src/relooper/emscripten/test.js +44 -0
  92. data/modules/emscripten/src/relooper/fuzzer.py +116 -0
  93. data/modules/emscripten/src/relooper/ministring.h +35 -0
  94. data/modules/emscripten/src/relooper/paper.pdf +0 -0
  95. data/modules/emscripten/src/relooper/test.cpp +262 -0
  96. data/modules/emscripten/src/relooper/test.txt +155 -0
  97. data/modules/emscripten/src/relooper/test2.c +44 -0
  98. data/modules/emscripten/src/relooper/test2.txt +12 -0
  99. data/modules/emscripten/src/relooper/test3.c +42 -0
  100. data/modules/emscripten/src/relooper/test3.txt +27 -0
  101. data/modules/emscripten/src/relooper/test4.cpp +40 -0
  102. data/modules/emscripten/src/relooper/test4.txt +23 -0
  103. data/modules/emscripten/src/relooper/test5.cpp +40 -0
  104. data/modules/emscripten/src/relooper/test5.txt +32 -0
  105. data/modules/emscripten/src/relooper/test6.cpp +31 -0
  106. data/modules/emscripten/src/relooper/test6.txt +12 -0
  107. data/modules/emscripten/src/relooper/test_dead.cpp +28 -0
  108. data/modules/emscripten/src/relooper/test_dead.txt +9 -0
  109. data/modules/emscripten/src/relooper/test_debug.cpp +30 -0
  110. data/modules/emscripten/src/relooper/test_debug.txt +128 -0
  111. data/modules/emscripten/src/relooper/test_fuzz1.cpp +52 -0
  112. data/modules/emscripten/src/relooper/test_fuzz1.txt +32 -0
  113. data/modules/emscripten/src/relooper/test_fuzz2.cpp +34 -0
  114. data/modules/emscripten/src/relooper/test_fuzz2.txt +13 -0
  115. data/modules/emscripten/src/relooper/test_fuzz3.cpp +36 -0
  116. data/modules/emscripten/src/relooper/test_fuzz3.txt +9 -0
  117. data/modules/emscripten/src/relooper/test_fuzz4.cpp +38 -0
  118. data/modules/emscripten/src/relooper/test_fuzz4.txt +19 -0
  119. data/modules/emscripten/src/relooper/test_fuzz5.cpp +57 -0
  120. data/modules/emscripten/src/relooper/test_fuzz5.txt +52 -0
  121. data/modules/emscripten/src/relooper/test_fuzz6.cpp +322 -0
  122. data/modules/emscripten/src/relooper/test_fuzz6.txt +108 -0
  123. data/modules/emscripten/src/relooper/test_inf.cpp +813 -0
  124. data/modules/emscripten/src/relooper/test_inf.txt +385 -0
  125. data/modules/emscripten/src/relooper/testit.sh +62 -0
  126. data/modules/emscripten/src/relooper/updateit.sh +17 -0
  127. data/modules/emscripten/src/relooper.js +11516 -0
  128. data/modules/emscripten/src/relooper.js.raw.js +11511 -0
  129. data/modules/emscripten/src/runtime.js +546 -0
  130. data/modules/emscripten/src/settings.js +1284 -0
  131. data/modules/emscripten/src/shell.html +92 -0
  132. data/modules/emscripten/src/shell.js +153 -0
  133. data/modules/emscripten/src/shell_sharedlib.js +12 -0
  134. data/modules/emscripten/src/socket.io.js +3870 -0
  135. data/modules/emscripten/src/utility.js +379 -0
  136. data/modules/emscripten/src/wrtcp.js +821 -0
  137. data/modules/emscripten/system/include/AL/al.h +172 -0
  138. data/modules/emscripten/system/include/AL/alc.h +84 -0
  139. data/modules/emscripten/system/include/EGL/egl.h +329 -0
  140. data/modules/emscripten/system/include/EGL/eglext.h +398 -0
  141. data/modules/emscripten/system/include/EGL/eglplatform.h +141 -0
  142. data/modules/emscripten/system/include/GL/freeglut_std.h +628 -0
  143. data/modules/emscripten/system/include/GL/gl.h +2241 -0
  144. data/modules/emscripten/system/include/GL/glew.h +6 -0
  145. data/modules/emscripten/system/include/GL/glext.h +11127 -0
  146. data/modules/emscripten/system/include/GL/glfw.h +518 -0
  147. data/modules/emscripten/system/include/GL/glu.h +353 -0
  148. data/modules/emscripten/system/include/GL/glut.h +21 -0
  149. data/modules/emscripten/system/include/GLES/gl.h +770 -0
  150. data/modules/emscripten/system/include/GLES/glext.h +1278 -0
  151. data/modules/emscripten/system/include/GLES/glplatform.h +30 -0
  152. data/modules/emscripten/system/include/GLES2/gl2.h +621 -0
  153. data/modules/emscripten/system/include/GLES2/gl2ext.h +803 -0
  154. data/modules/emscripten/system/include/GLES2/gl2platform.h +30 -0
  155. data/modules/emscripten/system/include/KHR/khrplatform.h +277 -0
  156. data/modules/emscripten/system/include/SDL/COPYING +19 -0
  157. data/modules/emscripten/system/include/SDL/SDL.h +162 -0
  158. data/modules/emscripten/system/include/SDL/SDL_assert.h +241 -0
  159. data/modules/emscripten/system/include/SDL/SDL_atomic.h +318 -0
  160. data/modules/emscripten/system/include/SDL/SDL_audio.h +509 -0
  161. data/modules/emscripten/system/include/SDL/SDL_blendmode.h +60 -0
  162. data/modules/emscripten/system/include/SDL/SDL_clipboard.h +75 -0
  163. data/modules/emscripten/system/include/SDL/SDL_compat.h +365 -0
  164. data/modules/emscripten/system/include/SDL/SDL_config.h +48 -0
  165. data/modules/emscripten/system/include/SDL/SDL_config.h.in +297 -0
  166. data/modules/emscripten/system/include/SDL/SDL_config_android.h +133 -0
  167. data/modules/emscripten/system/include/SDL/SDL_config_iphoneos.h +148 -0
  168. data/modules/emscripten/system/include/SDL/SDL_config_macosx.h +172 -0
  169. data/modules/emscripten/system/include/SDL/SDL_config_minimal.h +74 -0
  170. data/modules/emscripten/system/include/SDL/SDL_config_nintendods.h +129 -0
  171. data/modules/emscripten/system/include/SDL/SDL_config_pandora.h +125 -0
  172. data/modules/emscripten/system/include/SDL/SDL_config_windows.h +207 -0
  173. data/modules/emscripten/system/include/SDL/SDL_config_wiz.h +119 -0
  174. data/modules/emscripten/system/include/SDL/SDL_copying.h +20 -0
  175. data/modules/emscripten/system/include/SDL/SDL_cpuinfo.h +150 -0
  176. data/modules/emscripten/system/include/SDL/SDL_endian.h +248 -0
  177. data/modules/emscripten/system/include/SDL/SDL_error.h +77 -0
  178. data/modules/emscripten/system/include/SDL/SDL_events.h +639 -0
  179. data/modules/emscripten/system/include/SDL/SDL_gesture.h +91 -0
  180. data/modules/emscripten/system/include/SDL/SDL_gfxPrimitives.h +246 -0
  181. data/modules/emscripten/system/include/SDL/SDL_haptic.h +1200 -0
  182. data/modules/emscripten/system/include/SDL/SDL_hints.h +206 -0
  183. data/modules/emscripten/system/include/SDL/SDL_image.h +138 -0
  184. data/modules/emscripten/system/include/SDL/SDL_input.h +87 -0
  185. data/modules/emscripten/system/include/SDL/SDL_joystick.h +208 -0
  186. data/modules/emscripten/system/include/SDL/SDL_keyboard.h +169 -0
  187. data/modules/emscripten/system/include/SDL/SDL_keycode.h +344 -0
  188. data/modules/emscripten/system/include/SDL/SDL_loadso.h +85 -0
  189. data/modules/emscripten/system/include/SDL/SDL_log.h +211 -0
  190. data/modules/emscripten/system/include/SDL/SDL_main.h +98 -0
  191. data/modules/emscripten/system/include/SDL/SDL_mixer.h +634 -0
  192. data/modules/emscripten/system/include/SDL/SDL_mouse.h +213 -0
  193. data/modules/emscripten/system/include/SDL/SDL_mutex.h +248 -0
  194. data/modules/emscripten/system/include/SDL/SDL_name.h +11 -0
  195. data/modules/emscripten/system/include/SDL/SDL_opengl.h +11116 -0
  196. data/modules/emscripten/system/include/SDL/SDL_opengles.h +38 -0
  197. data/modules/emscripten/system/include/SDL/SDL_opengles2.h +38 -0
  198. data/modules/emscripten/system/include/SDL/SDL_pixels.h +423 -0
  199. data/modules/emscripten/system/include/SDL/SDL_platform.h +160 -0
  200. data/modules/emscripten/system/include/SDL/SDL_power.h +79 -0
  201. data/modules/emscripten/system/include/SDL/SDL_quit.h +58 -0
  202. data/modules/emscripten/system/include/SDL/SDL_rect.h +136 -0
  203. data/modules/emscripten/system/include/SDL/SDL_render.h +615 -0
  204. data/modules/emscripten/system/include/SDL/SDL_revision.h +2 -0
  205. data/modules/emscripten/system/include/SDL/SDL_revision.h.orig +2 -0
  206. data/modules/emscripten/system/include/SDL/SDL_rotozoom.h +123 -0
  207. data/modules/emscripten/system/include/SDL/SDL_rwops.h +220 -0
  208. data/modules/emscripten/system/include/SDL/SDL_scancode.h +398 -0
  209. data/modules/emscripten/system/include/SDL/SDL_shape.h +147 -0
  210. data/modules/emscripten/system/include/SDL/SDL_stdinc.h +764 -0
  211. data/modules/emscripten/system/include/SDL/SDL_surface.h +499 -0
  212. data/modules/emscripten/system/include/SDL/SDL_syswm.h +241 -0
  213. data/modules/emscripten/system/include/SDL/SDL_thread.h +182 -0
  214. data/modules/emscripten/system/include/SDL/SDL_timer.h +108 -0
  215. data/modules/emscripten/system/include/SDL/SDL_touch.h +124 -0
  216. data/modules/emscripten/system/include/SDL/SDL_ttf.h +249 -0
  217. data/modules/emscripten/system/include/SDL/SDL_types.h +29 -0
  218. data/modules/emscripten/system/include/SDL/SDL_version.h +166 -0
  219. data/modules/emscripten/system/include/SDL/SDL_video.h +820 -0
  220. data/modules/emscripten/system/include/SDL/begin_code.h +135 -0
  221. data/modules/emscripten/system/include/SDL/close_code.h +37 -0
  222. data/modules/emscripten/system/include/X11/X.h +717 -0
  223. data/modules/emscripten/system/include/X11/Xatom.h +79 -0
  224. data/modules/emscripten/system/include/X11/Xfuncproto.h +127 -0
  225. data/modules/emscripten/system/include/X11/Xlib.h +4023 -0
  226. data/modules/emscripten/system/include/X11/Xosdefs.h +116 -0
  227. data/modules/emscripten/system/include/X11/Xutil.h +826 -0
  228. data/modules/emscripten/system/include/X11/keysym.h +73 -0
  229. data/modules/emscripten/system/include/X11/keysymdef.h +2389 -0
  230. data/modules/emscripten/system/include/bsd/float.h +91 -0
  231. data/modules/emscripten/system/include/bsd/readme.txt +2 -0
  232. data/modules/emscripten/system/include/bsd/sys/mman.h +180 -0
  233. data/modules/emscripten/system/include/bsd/sys/utsname.h +70 -0
  234. data/modules/emscripten/system/include/dlfcn.h +31 -0
  235. data/modules/emscripten/system/include/emscripten/bind.h +1210 -0
  236. data/modules/emscripten/system/include/emscripten/emscripten.h +388 -0
  237. data/modules/emscripten/system/include/emscripten/val.h +311 -0
  238. data/modules/emscripten/system/include/emscripten/wire.h +393 -0
  239. data/modules/emscripten/system/include/err.h +95 -0
  240. data/modules/emscripten/system/include/execinfo.h +44 -0
  241. data/modules/emscripten/system/include/features.h +3 -0
  242. data/modules/emscripten/system/include/gc.h +70 -0
  243. data/modules/emscripten/system/include/gfx/png.h +3798 -0
  244. data/modules/emscripten/system/include/gfx/pngconf.h +1665 -0
  245. data/modules/emscripten/system/include/gfx/tiff.h +654 -0
  246. data/modules/emscripten/system/include/gfx/tiffconf.h +104 -0
  247. data/modules/emscripten/system/include/gfx/tiffio.h +526 -0
  248. data/modules/emscripten/system/include/gfx/tiffvers.h +9 -0
  249. data/modules/emscripten/system/include/jansson.h +323 -0
  250. data/modules/emscripten/system/include/jansson_config.h +54 -0
  251. data/modules/emscripten/system/include/libc/_ansi.h +135 -0
  252. data/modules/emscripten/system/include/libc/_syslist.h +40 -0
  253. data/modules/emscripten/system/include/libc/alloca.h +21 -0
  254. data/modules/emscripten/system/include/libc/ar.h +69 -0
  255. data/modules/emscripten/system/include/libc/argz.h +33 -0
  256. data/modules/emscripten/system/include/libc/assert.h +46 -0
  257. data/modules/emscripten/system/include/libc/complex.h +124 -0
  258. data/modules/emscripten/system/include/libc/ctype.h +196 -0
  259. data/modules/emscripten/system/include/libc/dirent.h +16 -0
  260. data/modules/emscripten/system/include/libc/endian.h +3 -0
  261. data/modules/emscripten/system/include/libc/envlock.h +15 -0
  262. data/modules/emscripten/system/include/libc/envz.h +16 -0
  263. data/modules/emscripten/system/include/libc/errno.h +11 -0
  264. data/modules/emscripten/system/include/libc/fastmath.h +13 -0
  265. data/modules/emscripten/system/include/libc/fcntl.h +1 -0
  266. data/modules/emscripten/system/include/libc/fnmatch.h +55 -0
  267. data/modules/emscripten/system/include/libc/getopt.h +196 -0
  268. data/modules/emscripten/system/include/libc/glob.h +89 -0
  269. data/modules/emscripten/system/include/libc/grp.h +94 -0
  270. data/modules/emscripten/system/include/libc/iconv.h +62 -0
  271. data/modules/emscripten/system/include/libc/ieeefp.h +256 -0
  272. data/modules/emscripten/system/include/libc/ifaddrs.h +64 -0
  273. data/modules/emscripten/system/include/libc/inttypes.h +290 -0
  274. data/modules/emscripten/system/include/libc/iso646.h +43 -0
  275. data/modules/emscripten/system/include/libc/langinfo.h +316 -0
  276. data/modules/emscripten/system/include/libc/libgen.h +23 -0
  277. data/modules/emscripten/system/include/libc/limits.h +155 -0
  278. data/modules/emscripten/system/include/libc/locale.h +80 -0
  279. data/modules/emscripten/system/include/libc/machine/_default_types.h +121 -0
  280. data/modules/emscripten/system/include/libc/machine/_types.h +8 -0
  281. data/modules/emscripten/system/include/libc/machine/ansi.h +1 -0
  282. data/modules/emscripten/system/include/libc/machine/endian.h +31 -0
  283. data/modules/emscripten/system/include/libc/machine/fastmath.h +100 -0
  284. data/modules/emscripten/system/include/libc/machine/ieeefp.h +376 -0
  285. data/modules/emscripten/system/include/libc/machine/malloc.h +8 -0
  286. data/modules/emscripten/system/include/libc/machine/param.h +1 -0
  287. data/modules/emscripten/system/include/libc/machine/setjmp-dj.h +43 -0
  288. data/modules/emscripten/system/include/libc/machine/setjmp.h +361 -0
  289. data/modules/emscripten/system/include/libc/machine/stdlib.h +8 -0
  290. data/modules/emscripten/system/include/libc/machine/termios.h +1 -0
  291. data/modules/emscripten/system/include/libc/machine/time.h +19 -0
  292. data/modules/emscripten/system/include/libc/machine/types.h +30 -0
  293. data/modules/emscripten/system/include/libc/malloc.h +169 -0
  294. data/modules/emscripten/system/include/libc/math.h +594 -0
  295. data/modules/emscripten/system/include/libc/newlib.h +2 -0
  296. data/modules/emscripten/system/include/libc/paths.h +7 -0
  297. data/modules/emscripten/system/include/libc/process.h +44 -0
  298. data/modules/emscripten/system/include/libc/pthread.h +362 -0
  299. data/modules/emscripten/system/include/libc/pwd.h +78 -0
  300. data/modules/emscripten/system/include/libc/readme.txt +3 -0
  301. data/modules/emscripten/system/include/libc/reent.h +183 -0
  302. data/modules/emscripten/system/include/libc/regdef.h +7 -0
  303. data/modules/emscripten/system/include/libc/regex.h +102 -0
  304. data/modules/emscripten/system/include/libc/sched.h +97 -0
  305. data/modules/emscripten/system/include/libc/search.h +59 -0
  306. data/modules/emscripten/system/include/libc/setjmp.h +20 -0
  307. data/modules/emscripten/system/include/libc/signal.h +30 -0
  308. data/modules/emscripten/system/include/libc/stdarg.h +50 -0
  309. data/modules/emscripten/system/include/libc/stddef.h +64 -0
  310. data/modules/emscripten/system/include/libc/stdint.h +493 -0
  311. data/modules/emscripten/system/include/libc/stdio.h +694 -0
  312. data/modules/emscripten/system/include/libc/stdlib.h +230 -0
  313. data/modules/emscripten/system/include/libc/string.h +105 -0
  314. data/modules/emscripten/system/include/libc/strings.h +35 -0
  315. data/modules/emscripten/system/include/libc/sys/_default_fcntl.h +223 -0
  316. data/modules/emscripten/system/include/libc/sys/_types.h +93 -0
  317. data/modules/emscripten/system/include/libc/sys/cdefs.h +123 -0
  318. data/modules/emscripten/system/include/libc/sys/config.h +255 -0
  319. data/modules/emscripten/system/include/libc/sys/custom_file.h +2 -0
  320. data/modules/emscripten/system/include/libc/sys/dir.h +10 -0
  321. data/modules/emscripten/system/include/libc/sys/dirent.h +58 -0
  322. data/modules/emscripten/system/include/libc/sys/errno.h +190 -0
  323. data/modules/emscripten/system/include/libc/sys/fcntl.h +4 -0
  324. data/modules/emscripten/system/include/libc/sys/features.h +212 -0
  325. data/modules/emscripten/system/include/libc/sys/file.h +2 -0
  326. data/modules/emscripten/system/include/libc/sys/iconvnls.h +77 -0
  327. data/modules/emscripten/system/include/libc/sys/lock.h +24 -0
  328. data/modules/emscripten/system/include/libc/sys/param.h +25 -0
  329. data/modules/emscripten/system/include/libc/sys/queue.h +471 -0
  330. data/modules/emscripten/system/include/libc/sys/reent.h +843 -0
  331. data/modules/emscripten/system/include/libc/sys/resource.h +59 -0
  332. data/modules/emscripten/system/include/libc/sys/sched.h +67 -0
  333. data/modules/emscripten/system/include/libc/sys/signal.h +314 -0
  334. data/modules/emscripten/system/include/libc/sys/stat.h +222 -0
  335. data/modules/emscripten/system/include/libc/sys/stdio.h +27 -0
  336. data/modules/emscripten/system/include/libc/sys/string.h +2 -0
  337. data/modules/emscripten/system/include/libc/sys/syslimits.h +65 -0
  338. data/modules/emscripten/system/include/libc/sys/termios.h +280 -0
  339. data/modules/emscripten/system/include/libc/sys/time.h +85 -0
  340. data/modules/emscripten/system/include/libc/sys/timeb.h +39 -0
  341. data/modules/emscripten/system/include/libc/sys/times.h +28 -0
  342. data/modules/emscripten/system/include/libc/sys/ttydefaults.h +97 -0
  343. data/modules/emscripten/system/include/libc/sys/types.h +481 -0
  344. data/modules/emscripten/system/include/libc/sys/unistd.h +514 -0
  345. data/modules/emscripten/system/include/libc/sys/utime.h +26 -0
  346. data/modules/emscripten/system/include/libc/sys/wait.h +40 -0
  347. data/modules/emscripten/system/include/libc/tar.h +39 -0
  348. data/modules/emscripten/system/include/libc/termios.h +7 -0
  349. data/modules/emscripten/system/include/libc/time.h +273 -0
  350. data/modules/emscripten/system/include/libc/unctrl.h +46 -0
  351. data/modules/emscripten/system/include/libc/unistd.h +6 -0
  352. data/modules/emscripten/system/include/libc/utime.h +12 -0
  353. data/modules/emscripten/system/include/libc/utmp.h +8 -0
  354. data/modules/emscripten/system/include/libc/wchar.h +194 -0
  355. data/modules/emscripten/system/include/libc/wctype.h +47 -0
  356. data/modules/emscripten/system/include/libc/wordexp.h +53 -0
  357. data/modules/emscripten/system/include/libcxx/CREDITS.TXT +91 -0
  358. data/modules/emscripten/system/include/libcxx/LICENSE.txt +76 -0
  359. data/modules/emscripten/system/include/libcxx/__bit_reference +1268 -0
  360. data/modules/emscripten/system/include/libcxx/__config +485 -0
  361. data/modules/emscripten/system/include/libcxx/__debug +193 -0
  362. data/modules/emscripten/system/include/libcxx/__functional_03 +2130 -0
  363. data/modules/emscripten/system/include/libcxx/__functional_base +437 -0
  364. data/modules/emscripten/system/include/libcxx/__functional_base_03 +1087 -0
  365. data/modules/emscripten/system/include/libcxx/__hash_table +1945 -0
  366. data/modules/emscripten/system/include/libcxx/__locale +1435 -0
  367. data/modules/emscripten/system/include/libcxx/__mutex_base +438 -0
  368. data/modules/emscripten/system/include/libcxx/__split_buffer +654 -0
  369. data/modules/emscripten/system/include/libcxx/__sso_allocator +77 -0
  370. data/modules/emscripten/system/include/libcxx/__std_stream +317 -0
  371. data/modules/emscripten/system/include/libcxx/__tree +2293 -0
  372. data/modules/emscripten/system/include/libcxx/__tuple +305 -0
  373. data/modules/emscripten/system/include/libcxx/__tuple_03 +27 -0
  374. data/modules/emscripten/system/include/libcxx/__undef_min_max +19 -0
  375. data/modules/emscripten/system/include/libcxx/algorithm +5458 -0
  376. data/modules/emscripten/system/include/libcxx/array +341 -0
  377. data/modules/emscripten/system/include/libcxx/atomic +1521 -0
  378. data/modules/emscripten/system/include/libcxx/bitset +1081 -0
  379. data/modules/emscripten/system/include/libcxx/cassert +25 -0
  380. data/modules/emscripten/system/include/libcxx/ccomplex +29 -0
  381. data/modules/emscripten/system/include/libcxx/cctype +164 -0
  382. data/modules/emscripten/system/include/libcxx/cerrno +393 -0
  383. data/modules/emscripten/system/include/libcxx/cfenv +82 -0
  384. data/modules/emscripten/system/include/libcxx/cfloat +78 -0
  385. data/modules/emscripten/system/include/libcxx/chrono +898 -0
  386. data/modules/emscripten/system/include/libcxx/cinttypes +259 -0
  387. data/modules/emscripten/system/include/libcxx/ciso646 +25 -0
  388. data/modules/emscripten/system/include/libcxx/climits +48 -0
  389. data/modules/emscripten/system/include/libcxx/clocale +53 -0
  390. data/modules/emscripten/system/include/libcxx/cmath +1683 -0
  391. data/modules/emscripten/system/include/libcxx/codecvt +547 -0
  392. data/modules/emscripten/system/include/libcxx/complex +1526 -0
  393. data/modules/emscripten/system/include/libcxx/complex.h +35 -0
  394. data/modules/emscripten/system/include/libcxx/condition_variable +256 -0
  395. data/modules/emscripten/system/include/libcxx/csetjmp +52 -0
  396. data/modules/emscripten/system/include/libcxx/csignal +58 -0
  397. data/modules/emscripten/system/include/libcxx/cstdarg +48 -0
  398. data/modules/emscripten/system/include/libcxx/cstdbool +32 -0
  399. data/modules/emscripten/system/include/libcxx/cstddef +103 -0
  400. data/modules/emscripten/system/include/libcxx/cstdint +191 -0
  401. data/modules/emscripten/system/include/libcxx/cstdio +175 -0
  402. data/modules/emscripten/system/include/libcxx/cstdlib +172 -0
  403. data/modules/emscripten/system/include/libcxx/cstring +112 -0
  404. data/modules/emscripten/system/include/libcxx/ctgmath +29 -0
  405. data/modules/emscripten/system/include/libcxx/ctime +72 -0
  406. data/modules/emscripten/system/include/libcxx/cwchar +208 -0
  407. data/modules/emscripten/system/include/libcxx/cwctype +213 -0
  408. data/modules/emscripten/system/include/libcxx/deque +2846 -0
  409. data/modules/emscripten/system/include/libcxx/exception +250 -0
  410. data/modules/emscripten/system/include/libcxx/ext/__hash +46 -0
  411. data/modules/emscripten/system/include/libcxx/ext/hash_map +1003 -0
  412. data/modules/emscripten/system/include/libcxx/ext/hash_set +657 -0
  413. data/modules/emscripten/system/include/libcxx/forward_list +1636 -0
  414. data/modules/emscripten/system/include/libcxx/fstream +1415 -0
  415. data/modules/emscripten/system/include/libcxx/functional +2063 -0
  416. data/modules/emscripten/system/include/libcxx/future +2505 -0
  417. data/modules/emscripten/system/include/libcxx/initializer_list +105 -0
  418. data/modules/emscripten/system/include/libcxx/iomanip +504 -0
  419. data/modules/emscripten/system/include/libcxx/ios +988 -0
  420. data/modules/emscripten/system/include/libcxx/iosfwd +194 -0
  421. data/modules/emscripten/system/include/libcxx/iostream +60 -0
  422. data/modules/emscripten/system/include/libcxx/istream +1713 -0
  423. data/modules/emscripten/system/include/libcxx/iterator +1869 -0
  424. data/modules/emscripten/system/include/libcxx/limits +809 -0
  425. data/modules/emscripten/system/include/libcxx/list +2275 -0
  426. data/modules/emscripten/system/include/libcxx/locale +4591 -0
  427. data/modules/emscripten/system/include/libcxx/map +1924 -0
  428. data/modules/emscripten/system/include/libcxx/memory +5437 -0
  429. data/modules/emscripten/system/include/libcxx/mutex +566 -0
  430. data/modules/emscripten/system/include/libcxx/new +117 -0
  431. data/modules/emscripten/system/include/libcxx/numeric +197 -0
  432. data/modules/emscripten/system/include/libcxx/ostream +1286 -0
  433. data/modules/emscripten/system/include/libcxx/queue +717 -0
  434. data/modules/emscripten/system/include/libcxx/random +6750 -0
  435. data/modules/emscripten/system/include/libcxx/ratio +487 -0
  436. data/modules/emscripten/system/include/libcxx/readme.txt +1 -0
  437. data/modules/emscripten/system/include/libcxx/regex +6439 -0
  438. data/modules/emscripten/system/include/libcxx/scoped_allocator +578 -0
  439. data/modules/emscripten/system/include/libcxx/set +1025 -0
  440. data/modules/emscripten/system/include/libcxx/sstream +888 -0
  441. data/modules/emscripten/system/include/libcxx/stack +292 -0
  442. data/modules/emscripten/system/include/libcxx/stdexcept +162 -0
  443. data/modules/emscripten/system/include/libcxx/streambuf +564 -0
  444. data/modules/emscripten/system/include/libcxx/string +3987 -0
  445. data/modules/emscripten/system/include/libcxx/strstream +400 -0
  446. data/modules/emscripten/system/include/libcxx/support/solaris/floatingpoint.h +5 -0
  447. data/modules/emscripten/system/include/libcxx/support/solaris/wchar.h +38 -0
  448. data/modules/emscripten/system/include/libcxx/support/solaris/xlocale.h +146 -0
  449. data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +79 -0
  450. data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +116 -0
  451. data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +113 -0
  452. data/modules/emscripten/system/include/libcxx/support/win32/support.h +115 -0
  453. data/modules/emscripten/system/include/libcxx/system_error +636 -0
  454. data/modules/emscripten/system/include/libcxx/tgmath.h +29 -0
  455. data/modules/emscripten/system/include/libcxx/thread +459 -0
  456. data/modules/emscripten/system/include/libcxx/tuple +1092 -0
  457. data/modules/emscripten/system/include/libcxx/type_traits +3040 -0
  458. data/modules/emscripten/system/include/libcxx/typeindex +103 -0
  459. data/modules/emscripten/system/include/libcxx/typeinfo +124 -0
  460. data/modules/emscripten/system/include/libcxx/unordered_map +1864 -0
  461. data/modules/emscripten/system/include/libcxx/unordered_set +1144 -0
  462. data/modules/emscripten/system/include/libcxx/utility +583 -0
  463. data/modules/emscripten/system/include/libcxx/valarray +4779 -0
  464. data/modules/emscripten/system/include/libcxx/vector +3228 -0
  465. data/modules/emscripten/system/include/memory.h +10 -0
  466. data/modules/emscripten/system/include/mntent.h +23 -0
  467. data/modules/emscripten/system/include/net/arpa/inet.h +32 -0
  468. data/modules/emscripten/system/include/net/arpa/nameser.h +535 -0
  469. data/modules/emscripten/system/include/net/arpa/nameser_compat.h +187 -0
  470. data/modules/emscripten/system/include/net/if.h +87 -0
  471. data/modules/emscripten/system/include/net/netinet/in.h +166 -0
  472. data/modules/emscripten/system/include/net/netinet/tcp.h +246 -0
  473. data/modules/emscripten/system/include/net/resolv.h +389 -0
  474. data/modules/emscripten/system/include/netdb.h +94 -0
  475. data/modules/emscripten/system/include/nl_types.h +19 -0
  476. data/modules/emscripten/system/include/poll.h +3 -0
  477. data/modules/emscripten/system/include/pty.h +6 -0
  478. data/modules/emscripten/system/include/semaphore.h +31 -0
  479. data/modules/emscripten/system/include/spawn.h +105 -0
  480. data/modules/emscripten/system/include/stdbool.h +16 -0
  481. data/modules/emscripten/system/include/sys/bitypes.h +3 -0
  482. data/modules/emscripten/system/include/sys/io.h +14 -0
  483. data/modules/emscripten/system/include/sys/ioctl.h +26 -0
  484. data/modules/emscripten/system/include/sys/poll.h +31 -0
  485. data/modules/emscripten/system/include/sys/select.h +14 -0
  486. data/modules/emscripten/system/include/sys/socket.h +101 -0
  487. data/modules/emscripten/system/include/sys/socketvar.h +3 -0
  488. data/modules/emscripten/system/include/sys/statvfs.h +32 -0
  489. data/modules/emscripten/system/include/sys/sysctl.h +14 -0
  490. data/modules/emscripten/system/include/sys/uio.h +22 -0
  491. data/modules/emscripten/system/include/sys/un.h +66 -0
  492. data/modules/emscripten/system/include/sysexits.h +108 -0
  493. data/modules/emscripten/system/include/unwind.h +154 -0
  494. data/modules/emscripten/system/include/xlocale.h +47 -0
  495. data/modules/emscripten/system/include/zconf.h +428 -0
  496. data/modules/emscripten/system/include/zlib.h +1613 -0
  497. data/modules/emscripten/system/lib/compiler-rt/LICENSE.TXT +97 -0
  498. data/modules/emscripten/system/lib/compiler-rt/divdi3.c +47 -0
  499. data/modules/emscripten/system/lib/compiler-rt/int_endianness.h +116 -0
  500. data/modules/emscripten/system/lib/compiler-rt/int_lib.h +46 -0
  501. data/modules/emscripten/system/lib/compiler-rt/int_math.h +67 -0
  502. data/modules/emscripten/system/lib/compiler-rt/int_types.h +140 -0
  503. data/modules/emscripten/system/lib/compiler-rt/int_util.h +29 -0
  504. data/modules/emscripten/system/lib/compiler-rt/muldi3.c +56 -0
  505. data/modules/emscripten/system/lib/compiler-rt/readme.txt +20 -0
  506. data/modules/emscripten/system/lib/compiler-rt/udivdi3.c +36 -0
  507. data/modules/emscripten/system/lib/compiler-rt/udivmoddi4.c +251 -0
  508. data/modules/emscripten/system/lib/debugging.cpp +24 -0
  509. data/modules/emscripten/system/lib/dlmalloc.c +6299 -0
  510. data/modules/emscripten/system/lib/embind/bind.cpp +63 -0
  511. data/modules/emscripten/system/lib/libc/gen/err.c +49 -0
  512. data/modules/emscripten/system/lib/libc/gen/errx.c +49 -0
  513. data/modules/emscripten/system/lib/libc/gen/verr.c +58 -0
  514. data/modules/emscripten/system/lib/libc/gen/verrx.c +51 -0
  515. data/modules/emscripten/system/lib/libc/gen/vwarn.c +55 -0
  516. data/modules/emscripten/system/lib/libc/gen/vwarnx.c +48 -0
  517. data/modules/emscripten/system/lib/libc/gen/warn.c +49 -0
  518. data/modules/emscripten/system/lib/libc/gen/warnx.c +49 -0
  519. data/modules/emscripten/system/lib/libc/musl/COPYRIGHT +92 -0
  520. data/modules/emscripten/system/lib/libc/musl/readme.txt +1 -0
  521. data/modules/emscripten/system/lib/libc/musl/src/ctype/alpha.h +125 -0
  522. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalnum.c +7 -0
  523. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalpha.c +14 -0
  524. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswblank.c +8 -0
  525. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswcntrl.c +10 -0
  526. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswctype.c +63 -0
  527. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswdigit.c +9 -0
  528. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswgraph.c +7 -0
  529. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswlower.c +6 -0
  530. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswprint.c +19 -0
  531. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswpunct.c +12 -0
  532. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswspace.c +19 -0
  533. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswupper.c +6 -0
  534. data/modules/emscripten/system/lib/libc/musl/src/ctype/iswxdigit.c +7 -0
  535. data/modules/emscripten/system/lib/libc/musl/src/ctype/nonspacing.h +62 -0
  536. data/modules/emscripten/system/lib/libc/musl/src/ctype/punct.h +109 -0
  537. data/modules/emscripten/system/lib/libc/musl/src/ctype/towctrans.c +268 -0
  538. data/modules/emscripten/system/lib/libc/musl/src/ctype/wcswidth.c +8 -0
  539. data/modules/emscripten/system/lib/libc/musl/src/ctype/wctrans.c +16 -0
  540. data/modules/emscripten/system/lib/libc/musl/src/ctype/wcwidth.c +29 -0
  541. data/modules/emscripten/system/lib/libc/musl/src/ctype/wide.h +42 -0
  542. data/modules/emscripten/system/lib/libc/musl/src/internal/libc.c +22 -0
  543. data/modules/emscripten/system/lib/libc/musl/src/internal/libc.h +71 -0
  544. data/modules/emscripten/system/lib/libc/musl/src/multibyte/btowc.c +7 -0
  545. data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.c +38 -0
  546. data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.h +22 -0
  547. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mblen.c +17 -0
  548. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrlen.c +18 -0
  549. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrtowc.c +57 -0
  550. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsinit.c +17 -0
  551. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsnrtowcs.c +65 -0
  552. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsrtowcs.c +100 -0
  553. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbstowcs.c +7 -0
  554. data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbtowc.c +53 -0
  555. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcrtomb.c +38 -0
  556. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsnrtombs.c +52 -0
  557. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsrtombs.c +58 -0
  558. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcstombs.c +7 -0
  559. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctob.c +8 -0
  560. data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctomb.c +18 -0
  561. data/modules/emscripten/system/lib/libc/musl/src/string/wcpcpy.c +6 -0
  562. data/modules/emscripten/system/lib/libc/musl/src/string/wcpncpy.c +6 -0
  563. data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp.c +7 -0
  564. data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp_l.c +6 -0
  565. data/modules/emscripten/system/lib/libc/musl/src/string/wcscat.c +7 -0
  566. data/modules/emscripten/system/lib/libc/musl/src/string/wcschr.c +8 -0
  567. data/modules/emscripten/system/lib/libc/musl/src/string/wcscmp.c +7 -0
  568. data/modules/emscripten/system/lib/libc/musl/src/string/wcscpy.c +8 -0
  569. data/modules/emscripten/system/lib/libc/musl/src/string/wcscspn.c +10 -0
  570. data/modules/emscripten/system/lib/libc/musl/src/string/wcsdup.c +11 -0
  571. data/modules/emscripten/system/lib/libc/musl/src/string/wcslen.c +8 -0
  572. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp.c +9 -0
  573. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp_l.c +6 -0
  574. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncat.c +10 -0
  575. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncmp.c +7 -0
  576. data/modules/emscripten/system/lib/libc/musl/src/string/wcsncpy.c +9 -0
  577. data/modules/emscripten/system/lib/libc/musl/src/string/wcsnlen.c +8 -0
  578. data/modules/emscripten/system/lib/libc/musl/src/string/wcspbrk.c +7 -0
  579. data/modules/emscripten/system/lib/libc/musl/src/string/wcsrchr.c +8 -0
  580. data/modules/emscripten/system/lib/libc/musl/src/string/wcsspn.c +8 -0
  581. data/modules/emscripten/system/lib/libc/musl/src/string/wcsstr.c +108 -0
  582. data/modules/emscripten/system/lib/libc/musl/src/string/wcstok.c +12 -0
  583. data/modules/emscripten/system/lib/libc/musl/src/string/wcswcs.c +6 -0
  584. data/modules/emscripten/system/lib/libc/musl/src/string/wmemchr.c +8 -0
  585. data/modules/emscripten/system/lib/libc/musl/src/string/wmemcmp.c +8 -0
  586. data/modules/emscripten/system/lib/libc/musl/src/string/wmemcpy.c +9 -0
  587. data/modules/emscripten/system/lib/libc/musl/src/string/wmemmove.c +12 -0
  588. data/modules/emscripten/system/lib/libc/musl/src/string/wmemset.c +9 -0
  589. data/modules/emscripten/system/lib/libc/stdlib/getopt_long.c +511 -0
  590. data/modules/emscripten/system/lib/libc/stdlib/strtod.c +305 -0
  591. data/modules/emscripten/system/lib/libc.symbols +81 -0
  592. data/modules/emscripten/system/lib/libcextra.symbols +61 -0
  593. data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +91 -0
  594. data/modules/emscripten/system/lib/libcxx/LICENSE.txt +76 -0
  595. data/modules/emscripten/system/lib/libcxx/algorithm.cpp +83 -0
  596. data/modules/emscripten/system/lib/libcxx/bind.cpp +30 -0
  597. data/modules/emscripten/system/lib/libcxx/chrono.cpp +132 -0
  598. data/modules/emscripten/system/lib/libcxx/condition_variable.cpp +81 -0
  599. data/modules/emscripten/system/lib/libcxx/debug.cpp +504 -0
  600. data/modules/emscripten/system/lib/libcxx/exception.cpp +226 -0
  601. data/modules/emscripten/system/lib/libcxx/future.cpp +285 -0
  602. data/modules/emscripten/system/lib/libcxx/hash.cpp +564 -0
  603. data/modules/emscripten/system/lib/libcxx/ios.cpp +455 -0
  604. data/modules/emscripten/system/lib/libcxx/iostream.cpp +68 -0
  605. data/modules/emscripten/system/lib/libcxx/locale.cpp +6093 -0
  606. data/modules/emscripten/system/lib/libcxx/memory.cpp +223 -0
  607. data/modules/emscripten/system/lib/libcxx/mutex.cpp +250 -0
  608. data/modules/emscripten/system/lib/libcxx/new.cpp +205 -0
  609. data/modules/emscripten/system/lib/libcxx/random.cpp +48 -0
  610. data/modules/emscripten/system/lib/libcxx/readme.txt +1 -0
  611. data/modules/emscripten/system/lib/libcxx/regex.cpp +325 -0
  612. data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +196 -0
  613. data/modules/emscripten/system/lib/libcxx/string.cpp +687 -0
  614. data/modules/emscripten/system/lib/libcxx/strstream.cpp +329 -0
  615. data/modules/emscripten/system/lib/libcxx/support/solaris/README +4 -0
  616. data/modules/emscripten/system/lib/libcxx/support/solaris/mbsnrtowcs.inc +76 -0
  617. data/modules/emscripten/system/lib/libcxx/support/solaris/wcsnrtombs.inc +93 -0
  618. data/modules/emscripten/system/lib/libcxx/support/solaris/xlocale.c +245 -0
  619. data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +94 -0
  620. data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +70 -0
  621. data/modules/emscripten/system/lib/libcxx/symbols +2927 -0
  622. data/modules/emscripten/system/lib/libcxx/system_error.cpp +201 -0
  623. data/modules/emscripten/system/lib/libcxx/thread.cpp +208 -0
  624. data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +60 -0
  625. data/modules/emscripten/system/lib/libcxx/utility.cpp +17 -0
  626. data/modules/emscripten/system/lib/libcxx/valarray.cpp +54 -0
  627. data/modules/emscripten/system/lib/libcxxabi/CREDITS.TXT +38 -0
  628. data/modules/emscripten/system/lib/libcxxabi/LICENSE.TXT +76 -0
  629. data/modules/emscripten/system/lib/libcxxabi/include/cxa_demangle.h +167 -0
  630. data/modules/emscripten/system/lib/libcxxabi/include/cxxabi.h +175 -0
  631. data/modules/emscripten/system/lib/libcxxabi/lib/buildit +99 -0
  632. data/modules/emscripten/system/lib/libcxxabi/readme.txt +1 -0
  633. data/modules/emscripten/system/lib/libcxxabi/src/abort_message.cpp +50 -0
  634. data/modules/emscripten/system/lib/libcxxabi/src/abort_message.h +33 -0
  635. data/modules/emscripten/system/lib/libcxxabi/src/cxa_aux_runtime.cpp +34 -0
  636. data/modules/emscripten/system/lib/libcxxabi/src/cxa_demangle.cpp +11036 -0
  637. data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.cpp +622 -0
  638. data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.hpp +123 -0
  639. data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception_storage.cpp +91 -0
  640. data/modules/emscripten/system/lib/libcxxabi/src/cxa_guard.cpp +231 -0
  641. data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.cpp +125 -0
  642. data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.hpp +54 -0
  643. data/modules/emscripten/system/lib/libcxxabi/src/cxa_new_delete.cpp +242 -0
  644. data/modules/emscripten/system/lib/libcxxabi/src/cxa_personality.cpp +1055 -0
  645. data/modules/emscripten/system/lib/libcxxabi/src/cxa_unexpected.cpp +27 -0
  646. data/modules/emscripten/system/lib/libcxxabi/src/cxa_vector.cpp +367 -0
  647. data/modules/emscripten/system/lib/libcxxabi/src/cxa_virtual.cpp +31 -0
  648. data/modules/emscripten/system/lib/libcxxabi/src/exception.cpp +41 -0
  649. data/modules/emscripten/system/lib/libcxxabi/src/fallback_malloc.ipp +174 -0
  650. data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.cpp +1146 -0
  651. data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.h +248 -0
  652. data/modules/emscripten/system/lib/libcxxabi/src/stdexcept.cpp +169 -0
  653. data/modules/emscripten/system/lib/libcxxabi/src/typeinfo.cpp +53 -0
  654. data/modules/emscripten/system/lib/libcxxabi/symbols +236 -0
  655. data/modules/emscripten/system/lib/sdl.cpp +13 -0
  656. data/modules/emscripten/system/lib/sdl.symbols +1 -0
  657. data/modules/emscripten/tests/hello_world.js +92 -0
  658. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/CppHeaderParser.py +2347 -0
  659. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/__init__.py +4 -0
  660. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/doc/CppHeaderParser.html +657 -0
  661. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/SampleClass.h +147 -0
  662. data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/readSampleClass.py +74 -0
  663. data/modules/emscripten/third_party/CppHeaderParser/PKG-INFO +249 -0
  664. data/modules/emscripten/third_party/CppHeaderParser/README.html +544 -0
  665. data/modules/emscripten/third_party/CppHeaderParser/README.txt +226 -0
  666. data/modules/emscripten/third_party/CppHeaderParser/setup.py +43 -0
  667. data/modules/emscripten/third_party/ansidecl.h +371 -0
  668. data/modules/emscripten/third_party/closure-compiler/COPYING +202 -0
  669. data/modules/emscripten/third_party/closure-compiler/README +292 -0
  670. data/modules/emscripten/third_party/closure-compiler/compiler.jar +0 -0
  671. data/modules/emscripten/third_party/closure-compiler/readme.txt +3 -0
  672. data/modules/emscripten/third_party/cp-demangle.h +161 -0
  673. data/modules/emscripten/third_party/demangle.h +549 -0
  674. data/modules/emscripten/third_party/demangler.py +49 -0
  675. data/modules/emscripten/third_party/gcc_demangler.c +4226 -0
  676. data/modules/emscripten/third_party/gcc_demangler.js +21282 -0
  677. data/modules/emscripten/third_party/jni/emjvm.cpp +133 -0
  678. data/modules/emscripten/third_party/jni/emjvm.h +8 -0
  679. data/modules/emscripten/third_party/jni/emjvm.js +185 -0
  680. data/modules/emscripten/third_party/jni/jni.h +1154 -0
  681. data/modules/emscripten/third_party/libiberty.h +634 -0
  682. data/modules/emscripten/third_party/lzma.js/README.markdown +37 -0
  683. data/modules/emscripten/third_party/lzma.js/doit.sh +37 -0
  684. data/modules/emscripten/third_party/lzma.js/lzip/AUTHORS +7 -0
  685. data/modules/emscripten/third_party/lzma.js/lzip/COPYING +676 -0
  686. data/modules/emscripten/third_party/lzma.js/lzip/ChangeLog +201 -0
  687. data/modules/emscripten/third_party/lzma.js/lzip/INSTALL +56 -0
  688. data/modules/emscripten/third_party/lzma.js/lzip/Makefile +160 -0
  689. data/modules/emscripten/third_party/lzma.js/lzip/Makefile.in +138 -0
  690. data/modules/emscripten/third_party/lzma.js/lzip/NEWS +22 -0
  691. data/modules/emscripten/third_party/lzma.js/lzip/README +77 -0
  692. data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.cc +204 -0
  693. data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.h +106 -0
  694. data/modules/emscripten/third_party/lzma.js/lzip/configure +192 -0
  695. data/modules/emscripten/third_party/lzma.js/lzip/decoder.cc +252 -0
  696. data/modules/emscripten/third_party/lzma.js/lzip/decoder.h +268 -0
  697. data/modules/emscripten/third_party/lzma.js/lzip/encoder.cc +643 -0
  698. data/modules/emscripten/third_party/lzma.js/lzip/encoder.h +582 -0
  699. data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.cc +378 -0
  700. data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.h +171 -0
  701. data/modules/emscripten/third_party/lzma.js/lzip/lzip.h +264 -0
  702. data/modules/emscripten/third_party/lzma.js/lzip/main.cc +545 -0
  703. data/modules/emscripten/third_party/lzma.js/lzma-decoder.js +27 -0
  704. data/modules/emscripten/third_party/lzma.js/lzma-full.js +27 -0
  705. data/modules/emscripten/third_party/lzma.js/native_test.sh +5 -0
  706. data/modules/emscripten/third_party/lzma.js/post.js +13 -0
  707. data/modules/emscripten/third_party/lzma.js/pre.js +13 -0
  708. data/modules/emscripten/third_party/lzma.js/test-decoder.js +39 -0
  709. data/modules/emscripten/third_party/lzma.js/test-full.html +9 -0
  710. data/modules/emscripten/third_party/lzma.js/test-full.js +78 -0
  711. data/modules/emscripten/third_party/ply/ANNOUNCE +40 -0
  712. data/modules/emscripten/third_party/ply/CHANGES +1093 -0
  713. data/modules/emscripten/third_party/ply/PKG-INFO +22 -0
  714. data/modules/emscripten/third_party/ply/README +271 -0
  715. data/modules/emscripten/third_party/ply/TODO +16 -0
  716. data/modules/emscripten/third_party/ply/doc/internal.html +874 -0
  717. data/modules/emscripten/third_party/ply/doc/makedoc.py +194 -0
  718. data/modules/emscripten/third_party/ply/doc/ply.html +3262 -0
  719. data/modules/emscripten/third_party/ply/example/BASIC/README +79 -0
  720. data/modules/emscripten/third_party/ply/example/BASIC/basic.py +71 -0
  721. data/modules/emscripten/third_party/ply/example/BASIC/basiclex.py +74 -0
  722. data/modules/emscripten/third_party/ply/example/BASIC/basiclog.py +79 -0
  723. data/modules/emscripten/third_party/ply/example/BASIC/basinterp.py +441 -0
  724. data/modules/emscripten/third_party/ply/example/BASIC/basparse.py +424 -0
  725. data/modules/emscripten/third_party/ply/example/BASIC/dim.bas +14 -0
  726. data/modules/emscripten/third_party/ply/example/BASIC/func.bas +5 -0
  727. data/modules/emscripten/third_party/ply/example/BASIC/gcd.bas +22 -0
  728. data/modules/emscripten/third_party/ply/example/BASIC/gosub.bas +13 -0
  729. data/modules/emscripten/third_party/ply/example/BASIC/hello.bas +4 -0
  730. data/modules/emscripten/third_party/ply/example/BASIC/linear.bas +17 -0
  731. data/modules/emscripten/third_party/ply/example/BASIC/maxsin.bas +12 -0
  732. data/modules/emscripten/third_party/ply/example/BASIC/powers.bas +13 -0
  733. data/modules/emscripten/third_party/ply/example/BASIC/rand.bas +4 -0
  734. data/modules/emscripten/third_party/ply/example/BASIC/sales.bas +20 -0
  735. data/modules/emscripten/third_party/ply/example/BASIC/sears.bas +18 -0
  736. data/modules/emscripten/third_party/ply/example/BASIC/sqrt1.bas +5 -0
  737. data/modules/emscripten/third_party/ply/example/BASIC/sqrt2.bas +4 -0
  738. data/modules/emscripten/third_party/ply/example/GardenSnake/GardenSnake.py +709 -0
  739. data/modules/emscripten/third_party/ply/example/GardenSnake/README +5 -0
  740. data/modules/emscripten/third_party/ply/example/README +10 -0
  741. data/modules/emscripten/third_party/ply/example/ansic/README +2 -0
  742. data/modules/emscripten/third_party/ply/example/ansic/clex.py +164 -0
  743. data/modules/emscripten/third_party/ply/example/ansic/cparse.py +863 -0
  744. data/modules/emscripten/third_party/ply/example/calc/calc.py +107 -0
  745. data/modules/emscripten/third_party/ply/example/calcdebug/calc.py +113 -0
  746. data/modules/emscripten/third_party/ply/example/classcalc/calc.py +157 -0
  747. data/modules/emscripten/third_party/ply/example/cleanup.sh +2 -0
  748. data/modules/emscripten/third_party/ply/example/closurecalc/calc.py +130 -0
  749. data/modules/emscripten/third_party/ply/example/hedit/hedit.py +48 -0
  750. data/modules/emscripten/third_party/ply/example/newclasscalc/calc.py +160 -0
  751. data/modules/emscripten/third_party/ply/example/optcalc/README +9 -0
  752. data/modules/emscripten/third_party/ply/example/optcalc/calc.py +119 -0
  753. data/modules/emscripten/third_party/ply/example/unicalc/calc.py +117 -0
  754. data/modules/emscripten/third_party/ply/example/yply/README +41 -0
  755. data/modules/emscripten/third_party/ply/example/yply/ylex.py +112 -0
  756. data/modules/emscripten/third_party/ply/example/yply/yparse.py +217 -0
  757. data/modules/emscripten/third_party/ply/example/yply/yply.py +53 -0
  758. data/modules/emscripten/third_party/ply/ply/__init__.py +4 -0
  759. data/modules/emscripten/third_party/ply/ply/cpp.py +898 -0
  760. data/modules/emscripten/third_party/ply/ply/ctokens.py +133 -0
  761. data/modules/emscripten/third_party/ply/ply/lex.py +1058 -0
  762. data/modules/emscripten/third_party/ply/ply/yacc.py +3276 -0
  763. data/modules/emscripten/third_party/ply/setup.py +31 -0
  764. data/modules/emscripten/third_party/ply/test/README +7 -0
  765. data/modules/emscripten/third_party/ply/test/calclex.py +49 -0
  766. data/modules/emscripten/third_party/ply/test/cleanup.sh +4 -0
  767. data/modules/emscripten/third_party/ply/test/lex_closure.py +54 -0
  768. data/modules/emscripten/third_party/ply/test/lex_doc1.py +26 -0
  769. data/modules/emscripten/third_party/ply/test/lex_dup1.py +29 -0
  770. data/modules/emscripten/third_party/ply/test/lex_dup2.py +33 -0
  771. data/modules/emscripten/third_party/ply/test/lex_dup3.py +31 -0
  772. data/modules/emscripten/third_party/ply/test/lex_empty.py +20 -0
  773. data/modules/emscripten/third_party/ply/test/lex_error1.py +24 -0
  774. data/modules/emscripten/third_party/ply/test/lex_error2.py +26 -0
  775. data/modules/emscripten/third_party/ply/test/lex_error3.py +27 -0
  776. data/modules/emscripten/third_party/ply/test/lex_error4.py +27 -0
  777. data/modules/emscripten/third_party/ply/test/lex_hedit.py +47 -0
  778. data/modules/emscripten/third_party/ply/test/lex_ignore.py +31 -0
  779. data/modules/emscripten/third_party/ply/test/lex_ignore2.py +29 -0
  780. data/modules/emscripten/third_party/ply/test/lex_literal1.py +25 -0
  781. data/modules/emscripten/third_party/ply/test/lex_literal2.py +25 -0
  782. data/modules/emscripten/third_party/ply/test/lex_many_tokens.py +27 -0
  783. data/modules/emscripten/third_party/ply/test/lex_module.py +10 -0
  784. data/modules/emscripten/third_party/ply/test/lex_module_import.py +42 -0
  785. data/modules/emscripten/third_party/ply/test/lex_object.py +55 -0
  786. data/modules/emscripten/third_party/ply/test/lex_opt_alias.py +54 -0
  787. data/modules/emscripten/third_party/ply/test/lex_optimize.py +50 -0
  788. data/modules/emscripten/third_party/ply/test/lex_optimize2.py +50 -0
  789. data/modules/emscripten/third_party/ply/test/lex_optimize3.py +52 -0
  790. data/modules/emscripten/third_party/ply/test/lex_re1.py +27 -0
  791. data/modules/emscripten/third_party/ply/test/lex_re2.py +27 -0
  792. data/modules/emscripten/third_party/ply/test/lex_re3.py +29 -0
  793. data/modules/emscripten/third_party/ply/test/lex_rule1.py +27 -0
  794. data/modules/emscripten/third_party/ply/test/lex_rule2.py +29 -0
  795. data/modules/emscripten/third_party/ply/test/lex_rule3.py +27 -0
  796. data/modules/emscripten/third_party/ply/test/lex_state1.py +40 -0
  797. data/modules/emscripten/third_party/ply/test/lex_state2.py +40 -0
  798. data/modules/emscripten/third_party/ply/test/lex_state3.py +42 -0
  799. data/modules/emscripten/third_party/ply/test/lex_state4.py +41 -0
  800. data/modules/emscripten/third_party/ply/test/lex_state5.py +40 -0
  801. data/modules/emscripten/third_party/ply/test/lex_state_noerror.py +39 -0
  802. data/modules/emscripten/third_party/ply/test/lex_state_norule.py +40 -0
  803. data/modules/emscripten/third_party/ply/test/lex_state_try.py +45 -0
  804. data/modules/emscripten/third_party/ply/test/lex_token1.py +19 -0
  805. data/modules/emscripten/third_party/ply/test/lex_token2.py +22 -0
  806. data/modules/emscripten/third_party/ply/test/lex_token3.py +24 -0
  807. data/modules/emscripten/third_party/ply/test/lex_token4.py +26 -0
  808. data/modules/emscripten/third_party/ply/test/lex_token5.py +31 -0
  809. data/modules/emscripten/third_party/ply/test/lex_token_dup.py +29 -0
  810. data/modules/emscripten/third_party/ply/test/testlex.py +606 -0
  811. data/modules/emscripten/third_party/ply/test/testyacc.py +347 -0
  812. data/modules/emscripten/third_party/ply/test/yacc_badargs.py +68 -0
  813. data/modules/emscripten/third_party/ply/test/yacc_badid.py +77 -0
  814. data/modules/emscripten/third_party/ply/test/yacc_badprec.py +64 -0
  815. data/modules/emscripten/third_party/ply/test/yacc_badprec2.py +68 -0
  816. data/modules/emscripten/third_party/ply/test/yacc_badprec3.py +68 -0
  817. data/modules/emscripten/third_party/ply/test/yacc_badrule.py +68 -0
  818. data/modules/emscripten/third_party/ply/test/yacc_badtok.py +68 -0
  819. data/modules/emscripten/third_party/ply/test/yacc_dup.py +68 -0
  820. data/modules/emscripten/third_party/ply/test/yacc_error1.py +68 -0
  821. data/modules/emscripten/third_party/ply/test/yacc_error2.py +68 -0
  822. data/modules/emscripten/third_party/ply/test/yacc_error3.py +67 -0
  823. data/modules/emscripten/third_party/ply/test/yacc_error4.py +72 -0
  824. data/modules/emscripten/third_party/ply/test/yacc_inf.py +56 -0
  825. data/modules/emscripten/third_party/ply/test/yacc_literal.py +69 -0
  826. data/modules/emscripten/third_party/ply/test/yacc_misplaced.py +68 -0
  827. data/modules/emscripten/third_party/ply/test/yacc_missing1.py +68 -0
  828. data/modules/emscripten/third_party/ply/test/yacc_nested.py +33 -0
  829. data/modules/emscripten/third_party/ply/test/yacc_nodoc.py +67 -0
  830. data/modules/emscripten/third_party/ply/test/yacc_noerror.py +66 -0
  831. data/modules/emscripten/third_party/ply/test/yacc_nop.py +68 -0
  832. data/modules/emscripten/third_party/ply/test/yacc_notfunc.py +66 -0
  833. data/modules/emscripten/third_party/ply/test/yacc_notok.py +67 -0
  834. data/modules/emscripten/third_party/ply/test/yacc_prec1.py +68 -0
  835. data/modules/emscripten/third_party/ply/test/yacc_rr.py +72 -0
  836. data/modules/emscripten/third_party/ply/test/yacc_rr_unused.py +30 -0
  837. data/modules/emscripten/third_party/ply/test/yacc_simple.py +68 -0
  838. data/modules/emscripten/third_party/ply/test/yacc_sr.py +63 -0
  839. data/modules/emscripten/third_party/ply/test/yacc_term1.py +68 -0
  840. data/modules/emscripten/third_party/ply/test/yacc_unused.py +77 -0
  841. data/modules/emscripten/third_party/ply/test/yacc_unused_rule.py +72 -0
  842. data/modules/emscripten/third_party/ply/test/yacc_uprec.py +63 -0
  843. data/modules/emscripten/third_party/ply/test/yacc_uprec2.py +63 -0
  844. data/modules/emscripten/third_party/readme.txt +7 -0
  845. data/modules/emscripten/third_party/websockify/CHANGES.txt +23 -0
  846. data/modules/emscripten/third_party/websockify/LICENSE.txt +16 -0
  847. data/modules/emscripten/third_party/websockify/MANIFEST.in +1 -0
  848. data/modules/emscripten/third_party/websockify/Makefile +11 -0
  849. data/modules/emscripten/third_party/websockify/README.md +168 -0
  850. data/modules/emscripten/third_party/websockify/Windows/Windows Service Readme.txt +39 -0
  851. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Program.cs +24 -0
  852. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs +61 -0
  853. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.cs +19 -0
  854. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.resx +129 -0
  855. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs +36 -0
  856. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.Designer.cs +37 -0
  857. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs +41 -0
  858. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj +75 -0
  859. data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.sln +20 -0
  860. data/modules/emscripten/third_party/websockify/docs/LICENSE.GPL-3 +621 -0
  861. data/modules/emscripten/third_party/websockify/docs/LICENSE.LGPL-3 +165 -0
  862. data/modules/emscripten/third_party/websockify/docs/LICENSE.MPL-2.0 +373 -0
  863. data/modules/emscripten/third_party/websockify/docs/TODO +9 -0
  864. data/modules/emscripten/third_party/websockify/docs/flash_policy.txt +4 -0
  865. data/modules/emscripten/third_party/websockify/docs/latency_results.txt +114 -0
  866. data/modules/emscripten/third_party/websockify/docs/notes +17 -0
  867. data/modules/emscripten/third_party/websockify/docs/release.txt +9 -0
  868. data/modules/emscripten/third_party/websockify/docs/websockify.1 +110 -0
  869. data/modules/emscripten/third_party/websockify/include/VT100.js +919 -0
  870. data/modules/emscripten/third_party/websockify/include/base64.js +114 -0
  871. data/modules/emscripten/third_party/websockify/include/keysym.js +99 -0
  872. data/modules/emscripten/third_party/websockify/include/util.js +359 -0
  873. data/modules/emscripten/third_party/websockify/include/web-socket-js/README.txt +109 -0
  874. data/modules/emscripten/third_party/websockify/include/web-socket-js/WebSocketMain.swf +0 -0
  875. data/modules/emscripten/third_party/websockify/include/web-socket-js/swfobject.js +4 -0
  876. data/modules/emscripten/third_party/websockify/include/web-socket-js/web_socket.js +391 -0
  877. data/modules/emscripten/third_party/websockify/include/websock.js +422 -0
  878. data/modules/emscripten/third_party/websockify/include/webutil.js +216 -0
  879. data/modules/emscripten/third_party/websockify/include/wsirc.js +235 -0
  880. data/modules/emscripten/third_party/websockify/include/wstelnet.js +335 -0
  881. data/modules/emscripten/third_party/websockify/other/Makefile +14 -0
  882. data/modules/emscripten/third_party/websockify/other/README.md +51 -0
  883. data/modules/emscripten/third_party/websockify/other/launch.sh +108 -0
  884. data/modules/emscripten/third_party/websockify/other/project.clj +13 -0
  885. data/modules/emscripten/third_party/websockify/other/websocket.c +802 -0
  886. data/modules/emscripten/third_party/websockify/other/websocket.h +84 -0
  887. data/modules/emscripten/third_party/websockify/other/websocket.rb +456 -0
  888. data/modules/emscripten/third_party/websockify/other/websockify.c +385 -0
  889. data/modules/emscripten/third_party/websockify/other/websockify.clj +233 -0
  890. data/modules/emscripten/third_party/websockify/other/websockify.js +196 -0
  891. data/modules/emscripten/third_party/websockify/other/websockify.rb +171 -0
  892. data/modules/emscripten/third_party/websockify/other/wswrap +22 -0
  893. data/modules/emscripten/third_party/websockify/rebind +18 -0
  894. data/modules/emscripten/third_party/websockify/rebind.c +94 -0
  895. data/modules/emscripten/third_party/websockify/run +5 -0
  896. data/modules/emscripten/third_party/websockify/setup.py +30 -0
  897. data/modules/emscripten/third_party/websockify/tests/b64_vs_utf8.py +29 -0
  898. data/modules/emscripten/third_party/websockify/tests/base64.html +91 -0
  899. data/modules/emscripten/third_party/websockify/tests/base64.js +12 -0
  900. data/modules/emscripten/third_party/websockify/tests/echo.html +148 -0
  901. data/modules/emscripten/third_party/websockify/tests/echo.py +75 -0
  902. data/modules/emscripten/third_party/websockify/tests/echo.rb +62 -0
  903. data/modules/emscripten/third_party/websockify/tests/latency.html +290 -0
  904. data/modules/emscripten/third_party/websockify/tests/latency.py +75 -0
  905. data/modules/emscripten/third_party/websockify/tests/load.html +250 -0
  906. data/modules/emscripten/third_party/websockify/tests/load.py +167 -0
  907. data/modules/emscripten/third_party/websockify/tests/plain_echo.html +168 -0
  908. data/modules/emscripten/third_party/websockify/tests/simple.html +68 -0
  909. data/modules/emscripten/third_party/websockify/tests/utf8-list.py +22 -0
  910. data/modules/emscripten/third_party/websockify/websockify/__init__.py +2 -0
  911. data/modules/emscripten/third_party/websockify/websockify/websocket.py +982 -0
  912. data/modules/emscripten/third_party/websockify/websockify/websocketproxy.py +393 -0
  913. data/modules/emscripten/third_party/websockify/websockify.py +5 -0
  914. data/modules/emscripten/third_party/websockify/wsirc.html +99 -0
  915. data/modules/emscripten/third_party/websockify/wstelnet.html +74 -0
  916. data/modules/emscripten/tools/__init__.py +0 -0
  917. data/modules/emscripten/tools/__init__.pyc +0 -0
  918. data/modules/emscripten/tools/autodebugger.py +289 -0
  919. data/modules/emscripten/tools/autodebugger_c.py +37 -0
  920. data/modules/emscripten/tools/autodebugger_indenter.py +18 -0
  921. data/modules/emscripten/tools/autodebugger_js.py +47 -0
  922. data/modules/emscripten/tools/autodediffer.py +60 -0
  923. data/modules/emscripten/tools/bindings_generator.py +832 -0
  924. data/modules/emscripten/tools/bisect_pair.py +88 -0
  925. data/modules/emscripten/tools/cache.py +198 -0
  926. data/modules/emscripten/tools/cache.pyc +0 -0
  927. data/modules/emscripten/tools/clean_webconsole.py +34 -0
  928. data/modules/emscripten/tools/crunch-worker.js +124 -0
  929. data/modules/emscripten/tools/diff_autodebugger.py +15 -0
  930. data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +5129 -0
  931. data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +6861 -0
  932. data/modules/emscripten/tools/eliminator/eliminator-test-output.js +6122 -0
  933. data/modules/emscripten/tools/eliminator/eliminator-test.js +8856 -0
  934. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.html +888 -0
  935. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.org +463 -0
  936. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/bin/uglifyjs +317 -0
  937. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/docstyle.css +75 -0
  938. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/object-ast.js +75 -0
  939. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/parse-js.js +1363 -0
  940. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/process.js +2005 -0
  941. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/squeeze-more.js +51 -0
  942. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/package.json +22 -0
  943. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/beautify.js +28 -0
  944. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/testparser.js +402 -0
  945. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array1.js +1 -0
  946. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array2.js +1 -0
  947. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array3.js +1 -0
  948. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array4.js +1 -0
  949. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/assignment.js +1 -0
  950. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/concatstring.js +1 -0
  951. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/const.js +1 -0
  952. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js +1 -0
  953. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/forstatement.js +1 -0
  954. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/if.js +1 -0
  955. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js +1 -0
  956. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js +1 -0
  957. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue10.js +1 -0
  958. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue11.js +1 -0
  959. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue13.js +1 -0
  960. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue14.js +1 -0
  961. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue16.js +1 -0
  962. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue17.js +1 -0
  963. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue20.js +1 -0
  964. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue21.js +1 -0
  965. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue25.js +1 -0
  966. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue27.js +1 -0
  967. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue28.js +1 -0
  968. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue29.js +1 -0
  969. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue30.js +1 -0
  970. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue34.js +1 -0
  971. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue4.js +1 -0
  972. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue48.js +1 -0
  973. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue50.js +1 -0
  974. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue53.js +1 -0
  975. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js +1 -0
  976. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue68.js +1 -0
  977. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue69.js +1 -0
  978. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue9.js +1 -0
  979. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/mangle.js +1 -0
  980. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js +1 -0
  981. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/var.js +1 -0
  982. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/with.js +1 -0
  983. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array1.js +3 -0
  984. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array2.js +4 -0
  985. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array3.js +4 -0
  986. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array4.js +6 -0
  987. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/assignment.js +20 -0
  988. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/concatstring.js +3 -0
  989. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/const.js +5 -0
  990. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js +4 -0
  991. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/forstatement.js +10 -0
  992. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/if.js +6 -0
  993. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn.js +9 -0
  994. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js +16 -0
  995. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue10.js +1 -0
  996. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue11.js +3 -0
  997. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue13.js +1 -0
  998. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue14.js +1 -0
  999. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue16.js +1 -0
  1000. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue17.js +4 -0
  1001. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue20.js +1 -0
  1002. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue21.js +6 -0
  1003. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue25.js +7 -0
  1004. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue27.js +1 -0
  1005. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue28.js +3 -0
  1006. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue29.js +1 -0
  1007. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue30.js +3 -0
  1008. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue34.js +3 -0
  1009. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue4.js +3 -0
  1010. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue48.js +1 -0
  1011. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue50.js +9 -0
  1012. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue53.js +1 -0
  1013. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue54.1.js +3 -0
  1014. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue68.js +5 -0
  1015. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue69.js +1 -0
  1016. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue9.js +4 -0
  1017. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/mangle.js +5 -0
  1018. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/strict-equals.js +3 -0
  1019. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/var.js +3 -0
  1020. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/with.js +2 -0
  1021. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/scripts.js +55 -0
  1022. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/hoist.js +33 -0
  1023. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument.js +97 -0
  1024. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument2.js +138 -0
  1025. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/test.js +16 -0
  1026. data/modules/emscripten/tools/eliminator/node_modules/uglify-js/uglify-js.js +17 -0
  1027. data/modules/emscripten/tools/eliminator/safe-eliminator-test-output.js +85 -0
  1028. data/modules/emscripten/tools/eliminator/safe-eliminator-test.js +103 -0
  1029. data/modules/emscripten/tools/emconfiguren.py +19 -0
  1030. data/modules/emscripten/tools/emmaken.py +230 -0
  1031. data/modules/emscripten/tools/emmakenxx.py +18 -0
  1032. data/modules/emscripten/tools/exec_llvm.py +50 -0
  1033. data/modules/emscripten/tools/file2json.py +49 -0
  1034. data/modules/emscripten/tools/file_packager.py +649 -0
  1035. data/modules/emscripten/tools/find_bigfuncs.py +23 -0
  1036. data/modules/emscripten/tools/find_bigis.py +18 -0
  1037. data/modules/emscripten/tools/fix_closure.py +88 -0
  1038. data/modules/emscripten/tools/ie7_fix.py +14 -0
  1039. data/modules/emscripten/tools/js-optimizer.js +3440 -0
  1040. data/modules/emscripten/tools/js_optimizer.py +341 -0
  1041. data/modules/emscripten/tools/js_optimizer.pyc +0 -0
  1042. data/modules/emscripten/tools/jsrun.py +27 -0
  1043. data/modules/emscripten/tools/jsrun.pyc +0 -0
  1044. data/modules/emscripten/tools/ll-strip.py +56 -0
  1045. data/modules/emscripten/tools/make_file.py +19 -0
  1046. data/modules/emscripten/tools/make_minigzip.py +13 -0
  1047. data/modules/emscripten/tools/namespacer.py +95 -0
  1048. data/modules/emscripten/tools/nativize_llvm.py +34 -0
  1049. data/modules/emscripten/tools/node_modules/source-map/CHANGELOG.md +58 -0
  1050. data/modules/emscripten/tools/node_modules/source-map/LICENSE +28 -0
  1051. data/modules/emscripten/tools/node_modules/source-map/Makefile.dryice.js +166 -0
  1052. data/modules/emscripten/tools/node_modules/source-map/README.md +347 -0
  1053. data/modules/emscripten/tools/node_modules/source-map/build/assert-shim.js +56 -0
  1054. data/modules/emscripten/tools/node_modules/source-map/build/mini-require.js +152 -0
  1055. data/modules/emscripten/tools/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  1056. data/modules/emscripten/tools/node_modules/source-map/build/prefix-utils.jsm +18 -0
  1057. data/modules/emscripten/tools/node_modules/source-map/build/suffix-browser.js +8 -0
  1058. data/modules/emscripten/tools/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  1059. data/modules/emscripten/tools/node_modules/source-map/build/suffix-utils.jsm +21 -0
  1060. data/modules/emscripten/tools/node_modules/source-map/build/test-prefix.js +8 -0
  1061. data/modules/emscripten/tools/node_modules/source-map/build/test-suffix.js +3 -0
  1062. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/array-set.js +96 -0
  1063. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
  1064. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64.js +42 -0
  1065. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/binary-search.js +81 -0
  1066. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-consumer.js +430 -0
  1067. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-generator.js +381 -0
  1068. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-node.js +353 -0
  1069. data/modules/emscripten/tools/node_modules/source-map/lib/source-map/util.js +117 -0
  1070. data/modules/emscripten/tools/node_modules/source-map/lib/source-map.js +8 -0
  1071. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  1072. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/README.md +119 -0
  1073. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  1074. data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/package.json +33 -0
  1075. data/modules/emscripten/tools/node_modules/source-map/package.json +74 -0
  1076. data/modules/emscripten/tools/node_modules/source-map/test/run-tests.js +73 -0
  1077. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-api.js +26 -0
  1078. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-array-set.js +71 -0
  1079. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
  1080. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64.js +35 -0
  1081. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  1082. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
  1083. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-consumer.js +306 -0
  1084. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-generator.js +391 -0
  1085. data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-node.js +282 -0
  1086. data/modules/emscripten/tools/node_modules/source-map/test/source-map/util.js +152 -0
  1087. data/modules/emscripten/tools/reproduceriter.js +216 -0
  1088. data/modules/emscripten/tools/reproduceriter.py +160 -0
  1089. data/modules/emscripten/tools/response_file.py +28 -0
  1090. data/modules/emscripten/tools/response_file.pyc +0 -0
  1091. data/modules/emscripten/tools/scan_js.py +20 -0
  1092. data/modules/emscripten/tools/scan_ll.py +18 -0
  1093. data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/__init__.py +3 -0
  1094. data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/emscripten.py +46 -0
  1095. data/modules/emscripten/tools/settings_template_readonly.py +47 -0
  1096. data/modules/emscripten/tools/shared.py +1437 -0
  1097. data/modules/emscripten/tools/shared.pyc +0 -0
  1098. data/modules/emscripten/tools/source-maps/sourcemap2json.js +15 -0
  1099. data/modules/emscripten/tools/source-maps/sourcemapper.js +177 -0
  1100. data/modules/emscripten/tools/split.py +97 -0
  1101. data/modules/emscripten/tools/tempfiles.py +40 -0
  1102. data/modules/emscripten/tools/tempfiles.pyc +0 -0
  1103. data/modules/emscripten/tools/test-js-optimizer-asm-last-output.js +75 -0
  1104. data/modules/emscripten/tools/test-js-optimizer-asm-last.js +91 -0
  1105. data/modules/emscripten/tools/test-js-optimizer-asm-outline-output.js +570 -0
  1106. data/modules/emscripten/tools/test-js-optimizer-asm-outline.js +606 -0
  1107. data/modules/emscripten/tools/test-js-optimizer-asm-pre-output.js +540 -0
  1108. data/modules/emscripten/tools/test-js-optimizer-asm-pre.js +550 -0
  1109. data/modules/emscripten/tools/test-js-optimizer-asm-regs-min-output.js +36 -0
  1110. data/modules/emscripten/tools/test-js-optimizer-asm-regs-min.js +37 -0
  1111. data/modules/emscripten/tools/test-js-optimizer-asm-regs-output.js +106 -0
  1112. data/modules/emscripten/tools/test-js-optimizer-asm-regs.js +110 -0
  1113. data/modules/emscripten/tools/test-js-optimizer-asm-relocate-output.js +9 -0
  1114. data/modules/emscripten/tools/test-js-optimizer-asm-relocate.js +12 -0
  1115. data/modules/emscripten/tools/test-js-optimizer-output.js +291 -0
  1116. data/modules/emscripten/tools/test-js-optimizer-regs-output.js +232 -0
  1117. data/modules/emscripten/tools/test-js-optimizer-regs.js +237 -0
  1118. data/modules/emscripten/tools/test-js-optimizer-t2-output.js +91 -0
  1119. data/modules/emscripten/tools/test-js-optimizer-t2.js +92 -0
  1120. data/modules/emscripten/tools/test-js-optimizer-t2c-output.js +17 -0
  1121. data/modules/emscripten/tools/test-js-optimizer-t2c.js +18 -0
  1122. data/modules/emscripten/tools/test-js-optimizer-t3-output.js +49 -0
  1123. data/modules/emscripten/tools/test-js-optimizer-t3.js +50 -0
  1124. data/modules/emscripten/tools/test-js-optimizer.js +401 -0
  1125. data/modules/mruby/AUTHORS +18 -0
  1126. data/modules/mruby/CONTRIBUTING.md +65 -0
  1127. data/modules/mruby/ChangeLog +15 -0
  1128. data/modules/mruby/INSTALL +29 -0
  1129. data/modules/mruby/LEGAL +6 -0
  1130. data/modules/mruby/MITL +20 -0
  1131. data/modules/mruby/Makefile +18 -0
  1132. data/modules/mruby/NEWS +13 -0
  1133. data/modules/mruby/README.md +116 -0
  1134. data/modules/mruby/Rakefile +114 -0
  1135. data/modules/mruby/TODO +11 -0
  1136. data/modules/mruby/benchmark/ao-render.rb +315 -0
  1137. data/modules/mruby/benchmark/bm_so_lists.rb +47 -0
  1138. data/modules/mruby/benchmark/fib39.rb +8 -0
  1139. data/modules/mruby/build_config.rb +88 -0
  1140. data/modules/mruby/doc/compile/README.md +376 -0
  1141. data/modules/mruby/doc/mrbgems/README.md +254 -0
  1142. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/README.md +4 -0
  1143. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +23 -0
  1144. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +5 -0
  1145. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +20 -0
  1146. data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/test/example.rb +7 -0
  1147. data/modules/mruby/examples/mrbgems/c_extension_example/README.md +4 -0
  1148. data/modules/mruby/examples/mrbgems/c_extension_example/mrbgem.rake +23 -0
  1149. data/modules/mruby/examples/mrbgems/c_extension_example/src/example.c +20 -0
  1150. data/modules/mruby/examples/mrbgems/c_extension_example/test/example.c +7 -0
  1151. data/modules/mruby/examples/mrbgems/c_extension_example/test/example.rb +3 -0
  1152. data/modules/mruby/examples/mrbgems/ruby_extension_example/README.md +4 -0
  1153. data/modules/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake +23 -0
  1154. data/modules/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +5 -0
  1155. data/modules/mruby/examples/mrbgems/ruby_extension_example/test/example.rb +3 -0
  1156. data/modules/mruby/examples/targets/ArduinoDue.rb +65 -0
  1157. data/modules/mruby/examples/targets/chipKitMax32.rb +68 -0
  1158. data/modules/mruby/include/mrbconf.h +87 -0
  1159. data/modules/mruby/include/mruby/array.h +63 -0
  1160. data/modules/mruby/include/mruby/class.h +75 -0
  1161. data/modules/mruby/include/mruby/compile.h +176 -0
  1162. data/modules/mruby/include/mruby/data.h +53 -0
  1163. data/modules/mruby/include/mruby/dump.h +151 -0
  1164. data/modules/mruby/include/mruby/gc.h +17 -0
  1165. data/modules/mruby/include/mruby/hash.h +54 -0
  1166. data/modules/mruby/include/mruby/irep.h +40 -0
  1167. data/modules/mruby/include/mruby/khash.h +257 -0
  1168. data/modules/mruby/include/mruby/numeric.h +32 -0
  1169. data/modules/mruby/include/mruby/proc.h +62 -0
  1170. data/modules/mruby/include/mruby/range.h +35 -0
  1171. data/modules/mruby/include/mruby/string.h +78 -0
  1172. data/modules/mruby/include/mruby/value.h +483 -0
  1173. data/modules/mruby/include/mruby/variable.h +78 -0
  1174. data/modules/mruby/include/mruby.h +388 -0
  1175. data/modules/mruby/minirake +477 -0
  1176. data/modules/mruby/mrbgems/default.gembox +61 -0
  1177. data/modules/mruby/mrbgems/full-core.gembox +9 -0
  1178. data/modules/mruby/mrbgems/mruby-array-ext/mrbgem.rake +4 -0
  1179. data/modules/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +204 -0
  1180. data/modules/mruby/mrbgems/mruby-array-ext/src/array.c +140 -0
  1181. data/modules/mruby/mrbgems/mruby-array-ext/test/array.rb +109 -0
  1182. data/modules/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +5 -0
  1183. data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +365 -0
  1184. data/modules/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +5 -0
  1185. data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +243 -0
  1186. data/modules/mruby/mrbgems/mruby-enum-ext/mrbgem.rake +4 -0
  1187. data/modules/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +164 -0
  1188. data/modules/mruby/mrbgems/mruby-enum-ext/test/enum.rb +44 -0
  1189. data/modules/mruby/mrbgems/mruby-eval/mrbgem.rake +4 -0
  1190. data/modules/mruby/mrbgems/mruby-eval/src/eval.c +23 -0
  1191. data/modules/mruby/mrbgems/mruby-fiber/mrbgem.rake +4 -0
  1192. data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +251 -0
  1193. data/modules/mruby/mrbgems/mruby-fiber/test/fiber.rb +64 -0
  1194. data/modules/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +4 -0
  1195. data/modules/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +13 -0
  1196. data/modules/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +62 -0
  1197. data/modules/mruby/mrbgems/mruby-hash-ext/test/hash.rb +26 -0
  1198. data/modules/mruby/mrbgems/mruby-math/mrbgem.rake +4 -0
  1199. data/modules/mruby/mrbgems/mruby-math/src/math.c +685 -0
  1200. data/modules/mruby/mrbgems/mruby-math/test/math.rb +136 -0
  1201. data/modules/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake +4 -0
  1202. data/modules/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +31 -0
  1203. data/modules/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +10 -0
  1204. data/modules/mruby/mrbgems/mruby-object-ext/mrbgem.rake +4 -0
  1205. data/modules/mruby/mrbgems/mruby-object-ext/src/object.c +108 -0
  1206. data/modules/mruby/mrbgems/mruby-object-ext/test/nil.rb +11 -0
  1207. data/modules/mruby/mrbgems/mruby-object-ext/test/object.rb +9 -0
  1208. data/modules/mruby/mrbgems/mruby-objectspace/mrbgem.rake +4 -0
  1209. data/modules/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +117 -0
  1210. data/modules/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +38 -0
  1211. data/modules/mruby/mrbgems/mruby-print/mrbgem.rake +4 -0
  1212. data/modules/mruby/mrbgems/mruby-print/mrblib/print.rb +64 -0
  1213. data/modules/mruby/mrbgems/mruby-print/src/print.c +44 -0
  1214. data/modules/mruby/mrbgems/mruby-proc-ext/mrbgem.rake +4 -0
  1215. data/modules/mruby/mrbgems/mruby-proc-ext/mrblib/proc.rb +40 -0
  1216. data/modules/mruby/mrbgems/mruby-proc-ext/src/proc.c +97 -0
  1217. data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.rb +41 -0
  1218. data/modules/mruby/mrbgems/mruby-random/mrbgem.rake +4 -0
  1219. data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.c +193 -0
  1220. data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.h +48 -0
  1221. data/modules/mruby/mrbgems/mruby-random/src/random.c +231 -0
  1222. data/modules/mruby/mrbgems/mruby-random/src/random.h +12 -0
  1223. data/modules/mruby/mrbgems/mruby-random/test/random.rb +32 -0
  1224. data/modules/mruby/mrbgems/mruby-range-ext/mrbgem.rake +4 -0
  1225. data/modules/mruby/mrbgems/mruby-range-ext/src/range.c +141 -0
  1226. data/modules/mruby/mrbgems/mruby-range-ext/test/range.rb +20 -0
  1227. data/modules/mruby/mrbgems/mruby-sprintf/mrbgem.rake +4 -0
  1228. data/modules/mruby/mrbgems/mruby-sprintf/src/kernel.c +30 -0
  1229. data/modules/mruby/mrbgems/mruby-sprintf/src/sprintf.c +1102 -0
  1230. data/modules/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +3 -0
  1231. data/modules/mruby/mrbgems/mruby-string-ext/mrbgem.rake +4 -0
  1232. data/modules/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +52 -0
  1233. data/modules/mruby/mrbgems/mruby-string-ext/src/string.c +175 -0
  1234. data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +112 -0
  1235. data/modules/mruby/mrbgems/mruby-struct/mrbgem.rake +4 -0
  1236. data/modules/mruby/mrbgems/mruby-struct/mrblib/struct.rb +50 -0
  1237. data/modules/mruby/mrbgems/mruby-struct/src/struct.c +818 -0
  1238. data/modules/mruby/mrbgems/mruby-struct/test/struct.rb +77 -0
  1239. data/modules/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake +4 -0
  1240. data/modules/mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +9 -0
  1241. data/modules/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +55 -0
  1242. data/modules/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +12 -0
  1243. data/modules/mruby/mrbgems/mruby-time/mrbgem.rake +4 -0
  1244. data/modules/mruby/mrbgems/mruby-time/src/time.c +749 -0
  1245. data/modules/mruby/mrbgems/mruby-time/test/time.rb +201 -0
  1246. data/modules/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake +4 -0
  1247. data/modules/mruby/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb +11 -0
  1248. data/modules/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb +24 -0
  1249. data/modules/mruby/mrblib/array.rb +111 -0
  1250. data/modules/mruby/mrblib/class.rb +26 -0
  1251. data/modules/mruby/mrblib/compar.rb +104 -0
  1252. data/modules/mruby/mrblib/enum.rb +398 -0
  1253. data/modules/mruby/mrblib/error.rb +66 -0
  1254. data/modules/mruby/mrblib/hash.rb +193 -0
  1255. data/modules/mruby/mrblib/init_mrblib.c +14 -0
  1256. data/modules/mruby/mrblib/kernel.rb +46 -0
  1257. data/modules/mruby/mrblib/mrblib.rake +18 -0
  1258. data/modules/mruby/mrblib/numeric.rb +101 -0
  1259. data/modules/mruby/mrblib/print.rb +18 -0
  1260. data/modules/mruby/mrblib/range.rb +40 -0
  1261. data/modules/mruby/mrblib/string.rb +145 -0
  1262. data/modules/mruby/src/array.c +1150 -0
  1263. data/modules/mruby/src/backtrace.c +73 -0
  1264. data/modules/mruby/src/class.c +1942 -0
  1265. data/modules/mruby/src/codegen.c +2864 -0
  1266. data/modules/mruby/src/compar.c +13 -0
  1267. data/modules/mruby/src/crc.c +38 -0
  1268. data/modules/mruby/src/dump.c +542 -0
  1269. data/modules/mruby/src/enum.c +14 -0
  1270. data/modules/mruby/src/error.c +454 -0
  1271. data/modules/mruby/src/error.h +18 -0
  1272. data/modules/mruby/src/etc.c +204 -0
  1273. data/modules/mruby/src/gc.c +1542 -0
  1274. data/modules/mruby/src/hash.c +1261 -0
  1275. data/modules/mruby/src/init.c +62 -0
  1276. data/modules/mruby/src/kernel.c +1105 -0
  1277. data/modules/mruby/src/keywords +50 -0
  1278. data/modules/mruby/src/lex.def +212 -0
  1279. data/modules/mruby/src/load.c +629 -0
  1280. data/modules/mruby/src/mruby_core.rake +28 -0
  1281. data/modules/mruby/src/node.h +117 -0
  1282. data/modules/mruby/src/numeric.c +1418 -0
  1283. data/modules/mruby/src/object.c +593 -0
  1284. data/modules/mruby/src/opcode.h +160 -0
  1285. data/modules/mruby/src/parse.y +6050 -0
  1286. data/modules/mruby/src/pool.c +190 -0
  1287. data/modules/mruby/src/print.c +71 -0
  1288. data/modules/mruby/src/proc.c +209 -0
  1289. data/modules/mruby/src/range.c +442 -0
  1290. data/modules/mruby/src/re.h +13 -0
  1291. data/modules/mruby/src/state.c +200 -0
  1292. data/modules/mruby/src/string.c +2580 -0
  1293. data/modules/mruby/src/symbol.c +456 -0
  1294. data/modules/mruby/src/value_array.h +27 -0
  1295. data/modules/mruby/src/variable.c +1147 -0
  1296. data/modules/mruby/src/vm.c +2129 -0
  1297. data/modules/mruby/tasks/libmruby.rake +18 -0
  1298. data/modules/mruby/tasks/mrbgem_spec.rake +297 -0
  1299. data/modules/mruby/tasks/mrbgems.rake +85 -0
  1300. data/modules/mruby/tasks/mrbgems_test.rake +88 -0
  1301. data/modules/mruby/tasks/mruby_build.rake +211 -0
  1302. data/modules/mruby/tasks/mruby_build_commands.rake +287 -0
  1303. data/modules/mruby/tasks/mruby_build_gem.rake +67 -0
  1304. data/modules/mruby/tasks/ruby_ext.rake +70 -0
  1305. data/modules/mruby/tasks/toolchains/androideabi.rake +126 -0
  1306. data/modules/mruby/tasks/toolchains/clang.rake +8 -0
  1307. data/modules/mruby/tasks/toolchains/gcc.rake +21 -0
  1308. data/modules/mruby/tasks/toolchains/vs2010.rake +3 -0
  1309. data/modules/mruby/tasks/toolchains/vs2012.rake +44 -0
  1310. data/modules/mruby/test/README.md +7 -0
  1311. data/modules/mruby/test/assert.rb +238 -0
  1312. data/modules/mruby/test/driver.c +118 -0
  1313. data/modules/mruby/test/init_mrbtest.c +24 -0
  1314. data/modules/mruby/test/mrbtest.rake +47 -0
  1315. data/modules/mruby/test/report.rb +4 -0
  1316. data/modules/mruby/test/t/argumenterror.rb +21 -0
  1317. data/modules/mruby/test/t/array.rb +309 -0
  1318. data/modules/mruby/test/t/basicobject.rb +11 -0
  1319. data/modules/mruby/test/t/bs_block.rb +489 -0
  1320. data/modules/mruby/test/t/bs_literal.rb +38 -0
  1321. data/modules/mruby/test/t/class.rb +219 -0
  1322. data/modules/mruby/test/t/comparable.rb +72 -0
  1323. data/modules/mruby/test/t/enumerable.rb +108 -0
  1324. data/modules/mruby/test/t/exception.rb +337 -0
  1325. data/modules/mruby/test/t/false.rb +33 -0
  1326. data/modules/mruby/test/t/float.rb +145 -0
  1327. data/modules/mruby/test/t/gc.rb +45 -0
  1328. data/modules/mruby/test/t/hash.rb +310 -0
  1329. data/modules/mruby/test/t/indexerror.rb +10 -0
  1330. data/modules/mruby/test/t/integer.rb +222 -0
  1331. data/modules/mruby/test/t/kernel.rb +425 -0
  1332. data/modules/mruby/test/t/literals.rb +287 -0
  1333. data/modules/mruby/test/t/localjumperror.rb +13 -0
  1334. data/modules/mruby/test/t/methods.rb +109 -0
  1335. data/modules/mruby/test/t/module.rb +344 -0
  1336. data/modules/mruby/test/t/nameerror.rb +32 -0
  1337. data/modules/mruby/test/t/nil.rb +29 -0
  1338. data/modules/mruby/test/t/nomethoderror.rb +13 -0
  1339. data/modules/mruby/test/t/numeric.rb +29 -0
  1340. data/modules/mruby/test/t/object.rb +11 -0
  1341. data/modules/mruby/test/t/proc.rb +56 -0
  1342. data/modules/mruby/test/t/range.rb +82 -0
  1343. data/modules/mruby/test/t/rangeerror.rb +10 -0
  1344. data/modules/mruby/test/t/regexperror.rb +4 -0
  1345. data/modules/mruby/test/t/runtimeerror.rb +6 -0
  1346. data/modules/mruby/test/t/standarderror.rb +10 -0
  1347. data/modules/mruby/test/t/string.rb +483 -0
  1348. data/modules/mruby/test/t/symbol.rb +27 -0
  1349. data/modules/mruby/test/t/syntax.rb +67 -0
  1350. data/modules/mruby/test/t/true.rb +33 -0
  1351. data/modules/mruby/test/t/typeerror.rb +11 -0
  1352. data/modules/mruby/tools/mrbc/mrbc.c +318 -0
  1353. data/modules/mruby/tools/mrbc/mrbc.rake +14 -0
  1354. data/modules/mruby/travis_config.rb +6 -0
  1355. data/modules/mrubymix/LICENSE +21 -0
  1356. data/modules/mrubymix/README.md +6 -0
  1357. data/modules/mrubymix/bin/mrubymix +29 -0
  1358. data/modules/mrubymix/lib/mrubymix.rb +93 -0
  1359. data/modules/mrubymix/mrubymix.gemspec +13 -0
  1360. data/scripts/gen_gems_config.rb +185 -0
  1361. data/scripts/gen_post.rb +104 -0
  1362. data/templates/minimal/Rakefile +36 -0
  1363. data/templates/minimal/app/app.rb +3 -0
  1364. metadata +1408 -0
@@ -0,0 +1,3987 @@
1
+ // -*- C++ -*-
2
+ //===--------------------------- string -----------------------------------===//
3
+ //
4
+ // The LLVM Compiler Infrastructure
5
+ //
6
+ // This file is distributed under the University of Illinois Open Source
7
+ // License. See LICENSE.TXT for details.
8
+ //
9
+ //===----------------------------------------------------------------------===//
10
+
11
+ #ifndef _LIBCPP_STRING
12
+ #define _LIBCPP_STRING
13
+
14
+ /*
15
+ string synopsis
16
+
17
+ namespace std
18
+ {
19
+
20
+ template <class stateT>
21
+ class fpos
22
+ {
23
+ private:
24
+ stateT st;
25
+ public:
26
+ fpos(streamoff = streamoff());
27
+
28
+ operator streamoff() const;
29
+
30
+ stateT state() const;
31
+ void state(stateT);
32
+
33
+ fpos& operator+=(streamoff);
34
+ fpos operator+ (streamoff) const;
35
+ fpos& operator-=(streamoff);
36
+ fpos operator- (streamoff) const;
37
+ };
38
+
39
+ template <class stateT> streamoff operator-(const fpos<stateT>& x, const fpos<stateT>& y);
40
+
41
+ template <class stateT> bool operator==(const fpos<stateT>& x, const fpos<stateT>& y);
42
+ template <class stateT> bool operator!=(const fpos<stateT>& x, const fpos<stateT>& y);
43
+
44
+ template <class charT>
45
+ struct char_traits
46
+ {
47
+ typedef charT char_type;
48
+ typedef ... int_type;
49
+ typedef streamoff off_type;
50
+ typedef streampos pos_type;
51
+ typedef mbstate_t state_type;
52
+
53
+ static void assign(char_type& c1, const char_type& c2) noexcept;
54
+ static constexpr bool eq(char_type c1, char_type c2) noexcept;
55
+ static constexpr bool lt(char_type c1, char_type c2) noexcept;
56
+
57
+ static int compare(const char_type* s1, const char_type* s2, size_t n);
58
+ static size_t length(const char_type* s);
59
+ static const char_type* find(const char_type* s, size_t n, const char_type& a);
60
+ static char_type* move(char_type* s1, const char_type* s2, size_t n);
61
+ static char_type* copy(char_type* s1, const char_type* s2, size_t n);
62
+ static char_type* assign(char_type* s, size_t n, char_type a);
63
+
64
+ static constexpr int_type not_eof(int_type c) noexcept;
65
+ static constexpr char_type to_char_type(int_type c) noexcept;
66
+ static constexpr int_type to_int_type(char_type c) noexcept;
67
+ static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
68
+ static constexpr int_type eof() noexcept;
69
+ };
70
+
71
+ template <> struct char_traits<char>;
72
+ template <> struct char_traits<wchar_t>;
73
+
74
+ template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
75
+ class basic_string
76
+ {
77
+ public:
78
+ // types:
79
+ typedef traits traits_type;
80
+ typedef typename traits_type::char_type value_type;
81
+ typedef Allocator allocator_type;
82
+ typedef typename allocator_type::size_type size_type;
83
+ typedef typename allocator_type::difference_type difference_type;
84
+ typedef typename allocator_type::reference reference;
85
+ typedef typename allocator_type::const_reference const_reference;
86
+ typedef typename allocator_type::pointer pointer;
87
+ typedef typename allocator_type::const_pointer const_pointer;
88
+ typedef implementation-defined iterator;
89
+ typedef implementation-defined const_iterator;
90
+ typedef std::reverse_iterator<iterator> reverse_iterator;
91
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
92
+
93
+ static const size_type npos = -1;
94
+
95
+ basic_string()
96
+ noexcept(is_nothrow_default_constructible<allocator_type>::value);
97
+ explicit basic_string(const allocator_type& a);
98
+ basic_string(const basic_string& str);
99
+ basic_string(basic_string&& str)
100
+ noexcept(is_nothrow_move_constructible<allocator_type>::value);
101
+ basic_string(const basic_string& str, size_type pos, size_type n = npos,
102
+ const allocator_type& a = allocator_type());
103
+ basic_string(const_pointer s, const allocator_type& a = allocator_type());
104
+ basic_string(const_pointer s, size_type n, const allocator_type& a = allocator_type());
105
+ basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
106
+ template<class InputIterator>
107
+ basic_string(InputIterator begin, InputIterator end,
108
+ const allocator_type& a = allocator_type());
109
+ basic_string(initializer_list<value_type>, const Allocator& = Allocator());
110
+ basic_string(const basic_string&, const Allocator&);
111
+ basic_string(basic_string&&, const Allocator&);
112
+
113
+ ~basic_string();
114
+
115
+ basic_string& operator=(const basic_string& str);
116
+ basic_string& operator=(basic_string&& str)
117
+ noexcept(
118
+ allocator_type::propagate_on_container_move_assignment::value &&
119
+ is_nothrow_move_assignable<allocator_type>::value);
120
+ basic_string& operator=(const_pointer s);
121
+ basic_string& operator=(value_type c);
122
+ basic_string& operator=(initializer_list<value_type>);
123
+
124
+ iterator begin() noexcept;
125
+ const_iterator begin() const noexcept;
126
+ iterator end() noexcept;
127
+ const_iterator end() const noexcept;
128
+
129
+ reverse_iterator rbegin() noexcept;
130
+ const_reverse_iterator rbegin() const noexcept;
131
+ reverse_iterator rend() noexcept;
132
+ const_reverse_iterator rend() const noexcept;
133
+
134
+ const_iterator cbegin() const noexcept;
135
+ const_iterator cend() const noexcept;
136
+ const_reverse_iterator crbegin() const noexcept;
137
+ const_reverse_iterator crend() const noexcept;
138
+
139
+ size_type size() const noexcept;
140
+ size_type length() const noexcept;
141
+ size_type max_size() const noexcept;
142
+ size_type capacity() const noexcept;
143
+
144
+ void resize(size_type n, value_type c);
145
+ void resize(size_type n);
146
+
147
+ void reserve(size_type res_arg = 0);
148
+ void shrink_to_fit();
149
+ void clear() noexcept;
150
+ bool empty() const noexcept;
151
+
152
+ const_reference operator[](size_type pos) const;
153
+ reference operator[](size_type pos);
154
+
155
+ const_reference at(size_type n) const;
156
+ reference at(size_type n);
157
+
158
+ basic_string& operator+=(const basic_string& str);
159
+ basic_string& operator+=(const_pointer s);
160
+ basic_string& operator+=(value_type c);
161
+ basic_string& operator+=(initializer_list<value_type>);
162
+
163
+ basic_string& append(const basic_string& str);
164
+ basic_string& append(const basic_string& str, size_type pos, size_type n);
165
+ basic_string& append(const_pointer s, size_type n);
166
+ basic_string& append(const_pointer s);
167
+ basic_string& append(size_type n, value_type c);
168
+ template<class InputIterator>
169
+ basic_string& append(InputIterator first, InputIterator last);
170
+ basic_string& append(initializer_list<value_type>);
171
+
172
+ void push_back(value_type c);
173
+ void pop_back();
174
+ reference front();
175
+ const_reference front() const;
176
+ reference back();
177
+ const_reference back() const;
178
+
179
+ basic_string& assign(const basic_string& str);
180
+ basic_string& assign(basic_string&& str);
181
+ basic_string& assign(const basic_string& str, size_type pos, size_type n);
182
+ basic_string& assign(const_pointer s, size_type n);
183
+ basic_string& assign(const_pointer s);
184
+ basic_string& assign(size_type n, value_type c);
185
+ template<class InputIterator>
186
+ basic_string& assign(InputIterator first, InputIterator last);
187
+ basic_string& assign(initializer_list<value_type>);
188
+
189
+ basic_string& insert(size_type pos1, const basic_string& str);
190
+ basic_string& insert(size_type pos1, const basic_string& str,
191
+ size_type pos2, size_type n);
192
+ basic_string& insert(size_type pos, const_pointer s, size_type n);
193
+ basic_string& insert(size_type pos, const_pointer s);
194
+ basic_string& insert(size_type pos, size_type n, value_type c);
195
+ iterator insert(const_iterator p, value_type c);
196
+ iterator insert(const_iterator p, size_type n, value_type c);
197
+ template<class InputIterator>
198
+ iterator insert(const_iterator p, InputIterator first, InputIterator last);
199
+ iterator insert(const_iterator p, initializer_list<value_type>);
200
+
201
+ basic_string& erase(size_type pos = 0, size_type n = npos);
202
+ iterator erase(const_iterator position);
203
+ iterator erase(const_iterator first, const_iterator last);
204
+
205
+ basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
206
+ basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
207
+ size_type pos2, size_type n2);
208
+ basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2);
209
+ basic_string& replace(size_type pos, size_type n1, const_pointer s);
210
+ basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
211
+ basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
212
+ basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n);
213
+ basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s);
214
+ basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
215
+ template<class InputIterator>
216
+ basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
217
+ basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
218
+
219
+ size_type copy(pointer s, size_type n, size_type pos = 0) const;
220
+ basic_string substr(size_type pos = 0, size_type n = npos) const;
221
+
222
+ void swap(basic_string& str)
223
+ noexcept(!allocator_type::propagate_on_container_swap::value ||
224
+ __is_nothrow_swappable<allocator_type>::value)
225
+
226
+ const_pointer c_str() const noexcept;
227
+ const_pointer data() const noexcept;
228
+
229
+ allocator_type get_allocator() const noexcept;
230
+
231
+ size_type find(const basic_string& str, size_type pos = 0) const noexcept;
232
+ size_type find(const_pointer s, size_type pos, size_type n) const noexcept;
233
+ size_type find(const_pointer s, size_type pos = 0) const noexcept;
234
+ size_type find(value_type c, size_type pos = 0) const noexcept;
235
+
236
+ size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
237
+ size_type rfind(const_pointer s, size_type pos, size_type n) const noexcept;
238
+ size_type rfind(const_pointer s, size_type pos = npos) const noexcept;
239
+ size_type rfind(value_type c, size_type pos = npos) const noexcept;
240
+
241
+ size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
242
+ size_type find_first_of(const_pointer s, size_type pos, size_type n) const noexcept;
243
+ size_type find_first_of(const_pointer s, size_type pos = 0) const noexcept;
244
+ size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
245
+
246
+ size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
247
+ size_type find_last_of(const_pointer s, size_type pos, size_type n) const noexcept;
248
+ size_type find_last_of(const_pointer s, size_type pos = npos) const noexcept;
249
+ size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
250
+
251
+ size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
252
+ size_type find_first_not_of(const_pointer s, size_type pos, size_type n) const noexcept;
253
+ size_type find_first_not_of(const_pointer s, size_type pos = 0) const noexcept;
254
+ size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
255
+
256
+ size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
257
+ size_type find_last_not_of(const_pointer s, size_type pos, size_type n) const noexcept;
258
+ size_type find_last_not_of(const_pointer s, size_type pos = npos) const noexcept;
259
+ size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
260
+
261
+ int compare(const basic_string& str) const noexcept;
262
+ int compare(size_type pos1, size_type n1, const basic_string& str) const;
263
+ int compare(size_type pos1, size_type n1, const basic_string& str,
264
+ size_type pos2, size_type n2) const;
265
+ int compare(const_pointer s) const noexcept;
266
+ int compare(size_type pos1, size_type n1, const_pointer s) const;
267
+ int compare(size_type pos1, size_type n1, const_pointer s, size_type n2) const;
268
+
269
+ bool __invariants() const;
270
+ };
271
+
272
+ template<class charT, class traits, class Allocator>
273
+ basic_string<charT, traits, Allocator>
274
+ operator+(const basic_string<charT, traits, Allocator>& lhs,
275
+ const basic_string<charT, traits, Allocator>& rhs);
276
+
277
+ template<class charT, class traits, class Allocator>
278
+ basic_string<charT, traits, Allocator>
279
+ operator+(const charT* lhs , const basic_string<charT,traits,Allocator>&rhs);
280
+
281
+ template<class charT, class traits, class Allocator>
282
+ basic_string<charT, traits, Allocator>
283
+ operator+(charT lhs, const basic_string<charT,traits,Allocator>& rhs);
284
+
285
+ template<class charT, class traits, class Allocator>
286
+ basic_string<charT, traits, Allocator>
287
+ operator+(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs);
288
+
289
+ template<class charT, class traits, class Allocator>
290
+ basic_string<charT, traits, Allocator>
291
+ operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs);
292
+
293
+ template<class charT, class traits, class Allocator>
294
+ bool operator==(const basic_string<charT, traits, Allocator>& lhs,
295
+ const basic_string<charT, traits, Allocator>& rhs) noexcept;
296
+
297
+ template<class charT, class traits, class Allocator>
298
+ bool operator==(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
299
+
300
+ template<class charT, class traits, class Allocator>
301
+ bool operator==(const basic_string<charT,traits,Allocator>& lhs, const charT* rhs) noexcept;
302
+
303
+ template<class charT, class traits, class Allocator>
304
+ bool operator!=(const basic_string<charT,traits,Allocator>& lhs,
305
+ const basic_string<charT, traits, Allocator>& rhs) noexcept;
306
+
307
+ template<class charT, class traits, class Allocator>
308
+ bool operator!=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
309
+
310
+ template<class charT, class traits, class Allocator>
311
+ bool operator!=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
312
+
313
+ template<class charT, class traits, class Allocator>
314
+ bool operator< (const basic_string<charT, traits, Allocator>& lhs,
315
+ const basic_string<charT, traits, Allocator>& rhs) noexcept;
316
+
317
+ template<class charT, class traits, class Allocator>
318
+ bool operator< (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
319
+
320
+ template<class charT, class traits, class Allocator>
321
+ bool operator< (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
322
+
323
+ template<class charT, class traits, class Allocator>
324
+ bool operator> (const basic_string<charT, traits, Allocator>& lhs,
325
+ const basic_string<charT, traits, Allocator>& rhs) noexcept;
326
+
327
+ template<class charT, class traits, class Allocator>
328
+ bool operator> (const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
329
+
330
+ template<class charT, class traits, class Allocator>
331
+ bool operator> (const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
332
+
333
+ template<class charT, class traits, class Allocator>
334
+ bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
335
+ const basic_string<charT, traits, Allocator>& rhs) noexcept;
336
+
337
+ template<class charT, class traits, class Allocator>
338
+ bool operator<=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
339
+
340
+ template<class charT, class traits, class Allocator>
341
+ bool operator<=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
342
+
343
+ template<class charT, class traits, class Allocator>
344
+ bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
345
+ const basic_string<charT, traits, Allocator>& rhs) noexcept;
346
+
347
+ template<class charT, class traits, class Allocator>
348
+ bool operator>=(const basic_string<charT, traits, Allocator>& lhs, const charT* rhs) noexcept;
349
+
350
+ template<class charT, class traits, class Allocator>
351
+ bool operator>=(const charT* lhs, const basic_string<charT, traits, Allocator>& rhs) noexcept;
352
+
353
+ template<class charT, class traits, class Allocator>
354
+ void swap(basic_string<charT, traits, Allocator>& lhs,
355
+ basic_string<charT, traits, Allocator>& rhs)
356
+ noexcept(noexcept(lhs.swap(rhs)));
357
+
358
+ template<class charT, class traits, class Allocator>
359
+ basic_istream<charT, traits>&
360
+ operator>>(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str);
361
+
362
+ template<class charT, class traits, class Allocator>
363
+ basic_ostream<charT, traits>&
364
+ operator<<(basic_ostream<charT, traits>& os, const basic_string<charT, traits, Allocator>& str);
365
+
366
+ template<class charT, class traits, class Allocator>
367
+ basic_istream<charT, traits>&
368
+ getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str,
369
+ charT delim);
370
+
371
+ template<class charT, class traits, class Allocator>
372
+ basic_istream<charT, traits>&
373
+ getline(basic_istream<charT, traits>& is, basic_string<charT, traits, Allocator>& str);
374
+
375
+ typedef basic_string<char> string;
376
+ typedef basic_string<wchar_t> wstring;
377
+ typedef basic_string<char16_t> u16string;
378
+ typedef basic_string<char32_t> u32string;
379
+
380
+ int stoi (const string& str, size_t* idx = 0, int base = 10);
381
+ long stol (const string& str, size_t* idx = 0, int base = 10);
382
+ unsigned long stoul (const string& str, size_t* idx = 0, int base = 10);
383
+ long long stoll (const string& str, size_t* idx = 0, int base = 10);
384
+ unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
385
+
386
+ float stof (const string& str, size_t* idx = 0);
387
+ double stod (const string& str, size_t* idx = 0);
388
+ long double stold(const string& str, size_t* idx = 0);
389
+
390
+ string to_string(int val);
391
+ string to_string(unsigned val);
392
+ string to_string(long val);
393
+ string to_string(unsigned long val);
394
+ string to_string(long long val);
395
+ string to_string(unsigned long long val);
396
+ string to_string(float val);
397
+ string to_string(double val);
398
+ string to_string(long double val);
399
+
400
+ int stoi (const wstring& str, size_t* idx = 0, int base = 10);
401
+ long stol (const wstring& str, size_t* idx = 0, int base = 10);
402
+ unsigned long stoul (const wstring& str, size_t* idx = 0, int base = 10);
403
+ long long stoll (const wstring& str, size_t* idx = 0, int base = 10);
404
+ unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
405
+
406
+ float stof (const wstring& str, size_t* idx = 0);
407
+ double stod (const wstring& str, size_t* idx = 0);
408
+ long double stold(const wstring& str, size_t* idx = 0);
409
+
410
+ wstring to_wstring(int val);
411
+ wstring to_wstring(unsigned val);
412
+ wstring to_wstring(long val);
413
+ wstring to_wstring(unsigned long val);
414
+ wstring to_wstring(long long val);
415
+ wstring to_wstring(unsigned long long val);
416
+ wstring to_wstring(float val);
417
+ wstring to_wstring(double val);
418
+ wstring to_wstring(long double val);
419
+
420
+ template <> struct hash<string>;
421
+ template <> struct hash<u16string>;
422
+ template <> struct hash<u32string>;
423
+ template <> struct hash<wstring>;
424
+
425
+ } // std
426
+
427
+ */
428
+
429
+ #include <__config>
430
+ #include <iosfwd>
431
+ #include <cstring>
432
+ #include <cstdio> // For EOF.
433
+ #include <cwchar>
434
+ #include <algorithm>
435
+ #include <iterator>
436
+ #include <utility>
437
+ #include <memory>
438
+ #include <stdexcept>
439
+ #include <type_traits>
440
+ #include <initializer_list>
441
+ #include <__functional_base>
442
+ #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
443
+ #include <cstdint>
444
+ #endif
445
+ #if defined(_LIBCPP_NO_EXCEPTIONS) || defined(_LIBCPP_DEBUG)
446
+ #include <cassert>
447
+ #endif
448
+
449
+ #include <__undef_min_max>
450
+
451
+ #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
452
+ #pragma GCC system_header
453
+ #endif
454
+
455
+ _LIBCPP_BEGIN_NAMESPACE_STD
456
+
457
+ // fpos
458
+
459
+ template <class _StateT>
460
+ class _LIBCPP_TYPE_VIS fpos
461
+ {
462
+ private:
463
+ _StateT __st_;
464
+ streamoff __off_;
465
+ public:
466
+ _LIBCPP_INLINE_VISIBILITY fpos(streamoff __off = streamoff()) : __st_(), __off_(__off) {}
467
+
468
+ _LIBCPP_INLINE_VISIBILITY operator streamoff() const {return __off_;}
469
+
470
+ _LIBCPP_INLINE_VISIBILITY _StateT state() const {return __st_;}
471
+ _LIBCPP_INLINE_VISIBILITY void state(_StateT __st) {__st_ = __st;}
472
+
473
+ _LIBCPP_INLINE_VISIBILITY fpos& operator+=(streamoff __off) {__off_ += __off; return *this;}
474
+ _LIBCPP_INLINE_VISIBILITY fpos operator+ (streamoff __off) const {fpos __t(*this); __t += __off; return __t;}
475
+ _LIBCPP_INLINE_VISIBILITY fpos& operator-=(streamoff __off) {__off_ -= __off; return *this;}
476
+ _LIBCPP_INLINE_VISIBILITY fpos operator- (streamoff __off) const {fpos __t(*this); __t -= __off; return __t;}
477
+ };
478
+
479
+ template <class _StateT>
480
+ inline _LIBCPP_INLINE_VISIBILITY
481
+ streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
482
+ {return streamoff(__x) - streamoff(__y);}
483
+
484
+ template <class _StateT>
485
+ inline _LIBCPP_INLINE_VISIBILITY
486
+ bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
487
+ {return streamoff(__x) == streamoff(__y);}
488
+
489
+ template <class _StateT>
490
+ inline _LIBCPP_INLINE_VISIBILITY
491
+ bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
492
+ {return streamoff(__x) != streamoff(__y);}
493
+
494
+ // char_traits
495
+
496
+ template <class _CharT>
497
+ struct _LIBCPP_TYPE_VIS char_traits
498
+ {
499
+ typedef _CharT char_type;
500
+ typedef int int_type;
501
+ typedef streamoff off_type;
502
+ typedef streampos pos_type;
503
+ typedef mbstate_t state_type;
504
+
505
+ _LIBCPP_INLINE_VISIBILITY
506
+ static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
507
+ {__c1 = __c2;}
508
+ _LIBCPP_INLINE_VISIBILITY
509
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
510
+ {return __c1 == __c2;}
511
+ _LIBCPP_INLINE_VISIBILITY
512
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
513
+ {return __c1 < __c2;}
514
+
515
+ static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
516
+ static size_t length(const char_type* __s);
517
+ static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
518
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
519
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
520
+ static char_type* assign(char_type* __s, size_t __n, char_type __a);
521
+
522
+ _LIBCPP_INLINE_VISIBILITY
523
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
524
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
525
+ _LIBCPP_INLINE_VISIBILITY
526
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
527
+ {return char_type(__c);}
528
+ _LIBCPP_INLINE_VISIBILITY
529
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
530
+ {return int_type(__c);}
531
+ _LIBCPP_INLINE_VISIBILITY
532
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
533
+ {return __c1 == __c2;}
534
+ _LIBCPP_INLINE_VISIBILITY
535
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
536
+ {return int_type(EOF);}
537
+ };
538
+
539
+ template <class _CharT>
540
+ int
541
+ char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
542
+ {
543
+ for (; __n; --__n, ++__s1, ++__s2)
544
+ {
545
+ if (lt(*__s1, *__s2))
546
+ return -1;
547
+ if (lt(*__s2, *__s1))
548
+ return 1;
549
+ }
550
+ return 0;
551
+ }
552
+
553
+ template <class _CharT>
554
+ inline _LIBCPP_INLINE_VISIBILITY
555
+ size_t
556
+ char_traits<_CharT>::length(const char_type* __s)
557
+ {
558
+ size_t __len = 0;
559
+ for (; !eq(*__s, char_type(0)); ++__s)
560
+ ++__len;
561
+ return __len;
562
+ }
563
+
564
+ template <class _CharT>
565
+ inline _LIBCPP_INLINE_VISIBILITY
566
+ const _CharT*
567
+ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
568
+ {
569
+ for (; __n; --__n)
570
+ {
571
+ if (eq(*__s, __a))
572
+ return __s;
573
+ ++__s;
574
+ }
575
+ return 0;
576
+ }
577
+
578
+ template <class _CharT>
579
+ _CharT*
580
+ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
581
+ {
582
+ char_type* __r = __s1;
583
+ if (__s1 < __s2)
584
+ {
585
+ for (; __n; --__n, ++__s1, ++__s2)
586
+ assign(*__s1, *__s2);
587
+ }
588
+ else if (__s2 < __s1)
589
+ {
590
+ __s1 += __n;
591
+ __s2 += __n;
592
+ for (; __n; --__n)
593
+ assign(*--__s1, *--__s2);
594
+ }
595
+ return __r;
596
+ }
597
+
598
+ template <class _CharT>
599
+ inline _LIBCPP_INLINE_VISIBILITY
600
+ _CharT*
601
+ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
602
+ {
603
+ char_type* __r = __s1;
604
+ for (; __n; --__n, ++__s1, ++__s2)
605
+ assign(*__s1, *__s2);
606
+ return __r;
607
+ }
608
+
609
+ template <class _CharT>
610
+ inline _LIBCPP_INLINE_VISIBILITY
611
+ _CharT*
612
+ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
613
+ {
614
+ char_type* __r = __s;
615
+ for (; __n; --__n, ++__s)
616
+ assign(*__s, __a);
617
+ return __r;
618
+ }
619
+
620
+ // char_traits<char>
621
+
622
+ template <>
623
+ struct _LIBCPP_TYPE_VIS char_traits<char>
624
+ {
625
+ typedef char char_type;
626
+ typedef int int_type;
627
+ typedef streamoff off_type;
628
+ typedef streampos pos_type;
629
+ typedef mbstate_t state_type;
630
+
631
+ _LIBCPP_INLINE_VISIBILITY
632
+ static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
633
+ {__c1 = __c2;}
634
+ _LIBCPP_INLINE_VISIBILITY
635
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
636
+ {return __c1 == __c2;}
637
+ _LIBCPP_INLINE_VISIBILITY
638
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
639
+ {return (unsigned char)__c1 < (unsigned char)__c2;}
640
+
641
+ _LIBCPP_INLINE_VISIBILITY
642
+ static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
643
+ {return memcmp(__s1, __s2, __n);}
644
+ _LIBCPP_INLINE_VISIBILITY
645
+ static size_t length(const char_type* __s) {return strlen(__s);}
646
+ _LIBCPP_INLINE_VISIBILITY
647
+ static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
648
+ {return (const char_type*)memchr(__s, to_int_type(__a), __n);}
649
+ _LIBCPP_INLINE_VISIBILITY
650
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
651
+ {return (char_type*)memmove(__s1, __s2, __n);}
652
+ _LIBCPP_INLINE_VISIBILITY
653
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
654
+ {return (char_type*)memcpy(__s1, __s2, __n);}
655
+ _LIBCPP_INLINE_VISIBILITY
656
+ static char_type* assign(char_type* __s, size_t __n, char_type __a)
657
+ {return (char_type*)memset(__s, to_int_type(__a), __n);}
658
+
659
+ _LIBCPP_INLINE_VISIBILITY
660
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
661
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
662
+ _LIBCPP_INLINE_VISIBILITY
663
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
664
+ {return char_type(__c);}
665
+ _LIBCPP_INLINE_VISIBILITY
666
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
667
+ {return int_type((unsigned char)__c);}
668
+ _LIBCPP_INLINE_VISIBILITY
669
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
670
+ {return __c1 == __c2;}
671
+ _LIBCPP_INLINE_VISIBILITY
672
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
673
+ {return int_type(EOF);}
674
+ };
675
+
676
+ // char_traits<wchar_t>
677
+
678
+ template <>
679
+ struct _LIBCPP_TYPE_VIS char_traits<wchar_t>
680
+ {
681
+ typedef wchar_t char_type;
682
+ typedef wint_t int_type;
683
+ typedef streamoff off_type;
684
+ typedef streampos pos_type;
685
+ typedef mbstate_t state_type;
686
+
687
+ _LIBCPP_INLINE_VISIBILITY
688
+ static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
689
+ {__c1 = __c2;}
690
+ _LIBCPP_INLINE_VISIBILITY
691
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
692
+ {return __c1 == __c2;}
693
+ _LIBCPP_INLINE_VISIBILITY
694
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
695
+ {return __c1 < __c2;}
696
+
697
+ _LIBCPP_INLINE_VISIBILITY
698
+ static int compare(const char_type* __s1, const char_type* __s2, size_t __n)
699
+ {return wmemcmp(__s1, __s2, __n);}
700
+ _LIBCPP_INLINE_VISIBILITY
701
+ static size_t length(const char_type* __s)
702
+ {return wcslen(__s);}
703
+ _LIBCPP_INLINE_VISIBILITY
704
+ static const char_type* find(const char_type* __s, size_t __n, const char_type& __a)
705
+ {return (const char_type*)wmemchr(__s, __a, __n);}
706
+ _LIBCPP_INLINE_VISIBILITY
707
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n)
708
+ {return (char_type*)wmemmove(__s1, __s2, __n);}
709
+ _LIBCPP_INLINE_VISIBILITY
710
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n)
711
+ {return (char_type*)wmemcpy(__s1, __s2, __n);}
712
+ _LIBCPP_INLINE_VISIBILITY
713
+ static char_type* assign(char_type* __s, size_t __n, char_type __a)
714
+ {return (char_type*)wmemset(__s, __a, __n);}
715
+
716
+ _LIBCPP_INLINE_VISIBILITY
717
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
718
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
719
+ _LIBCPP_INLINE_VISIBILITY
720
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
721
+ {return char_type(__c);}
722
+ _LIBCPP_INLINE_VISIBILITY
723
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
724
+ {return int_type(__c);}
725
+ _LIBCPP_INLINE_VISIBILITY
726
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
727
+ {return __c1 == __c2;}
728
+ _LIBCPP_INLINE_VISIBILITY
729
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
730
+ {return int_type(WEOF);}
731
+ };
732
+
733
+ #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
734
+
735
+ template <>
736
+ struct _LIBCPP_TYPE_VIS char_traits<char16_t>
737
+ {
738
+ typedef char16_t char_type;
739
+ typedef uint_least16_t int_type;
740
+ typedef streamoff off_type;
741
+ typedef u16streampos pos_type;
742
+ typedef mbstate_t state_type;
743
+
744
+ _LIBCPP_INLINE_VISIBILITY
745
+ static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
746
+ {__c1 = __c2;}
747
+ _LIBCPP_INLINE_VISIBILITY
748
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
749
+ {return __c1 == __c2;}
750
+ _LIBCPP_INLINE_VISIBILITY
751
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
752
+ {return __c1 < __c2;}
753
+
754
+ static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
755
+ static size_t length(const char_type* __s);
756
+ static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
757
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
758
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
759
+ static char_type* assign(char_type* __s, size_t __n, char_type __a);
760
+
761
+ _LIBCPP_INLINE_VISIBILITY
762
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
763
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
764
+ _LIBCPP_INLINE_VISIBILITY
765
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
766
+ {return char_type(__c);}
767
+ _LIBCPP_INLINE_VISIBILITY
768
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
769
+ {return int_type(__c);}
770
+ _LIBCPP_INLINE_VISIBILITY
771
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
772
+ {return __c1 == __c2;}
773
+ _LIBCPP_INLINE_VISIBILITY
774
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
775
+ {return int_type(0xDFFF);}
776
+ };
777
+
778
+ inline _LIBCPP_INLINE_VISIBILITY
779
+ int
780
+ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
781
+ {
782
+ for (; __n; --__n, ++__s1, ++__s2)
783
+ {
784
+ if (lt(*__s1, *__s2))
785
+ return -1;
786
+ if (lt(*__s2, *__s1))
787
+ return 1;
788
+ }
789
+ return 0;
790
+ }
791
+
792
+ inline _LIBCPP_INLINE_VISIBILITY
793
+ size_t
794
+ char_traits<char16_t>::length(const char_type* __s)
795
+ {
796
+ size_t __len = 0;
797
+ for (; !eq(*__s, char_type(0)); ++__s)
798
+ ++__len;
799
+ return __len;
800
+ }
801
+
802
+ inline _LIBCPP_INLINE_VISIBILITY
803
+ const char16_t*
804
+ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a)
805
+ {
806
+ for (; __n; --__n)
807
+ {
808
+ if (eq(*__s, __a))
809
+ return __s;
810
+ ++__s;
811
+ }
812
+ return 0;
813
+ }
814
+
815
+ inline _LIBCPP_INLINE_VISIBILITY
816
+ char16_t*
817
+ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
818
+ {
819
+ char_type* __r = __s1;
820
+ if (__s1 < __s2)
821
+ {
822
+ for (; __n; --__n, ++__s1, ++__s2)
823
+ assign(*__s1, *__s2);
824
+ }
825
+ else if (__s2 < __s1)
826
+ {
827
+ __s1 += __n;
828
+ __s2 += __n;
829
+ for (; __n; --__n)
830
+ assign(*--__s1, *--__s2);
831
+ }
832
+ return __r;
833
+ }
834
+
835
+ inline _LIBCPP_INLINE_VISIBILITY
836
+ char16_t*
837
+ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
838
+ {
839
+ char_type* __r = __s1;
840
+ for (; __n; --__n, ++__s1, ++__s2)
841
+ assign(*__s1, *__s2);
842
+ return __r;
843
+ }
844
+
845
+ inline _LIBCPP_INLINE_VISIBILITY
846
+ char16_t*
847
+ char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
848
+ {
849
+ char_type* __r = __s;
850
+ for (; __n; --__n, ++__s)
851
+ assign(*__s, __a);
852
+ return __r;
853
+ }
854
+
855
+ template <>
856
+ struct _LIBCPP_TYPE_VIS char_traits<char32_t>
857
+ {
858
+ typedef char32_t char_type;
859
+ typedef uint_least32_t int_type;
860
+ typedef streamoff off_type;
861
+ typedef u32streampos pos_type;
862
+ typedef mbstate_t state_type;
863
+
864
+ _LIBCPP_INLINE_VISIBILITY
865
+ static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
866
+ {__c1 = __c2;}
867
+ _LIBCPP_INLINE_VISIBILITY
868
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
869
+ {return __c1 == __c2;}
870
+ _LIBCPP_INLINE_VISIBILITY
871
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
872
+ {return __c1 < __c2;}
873
+
874
+ static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
875
+ static size_t length(const char_type* __s);
876
+ static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
877
+ static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
878
+ static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
879
+ static char_type* assign(char_type* __s, size_t __n, char_type __a);
880
+
881
+ _LIBCPP_INLINE_VISIBILITY
882
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
883
+ {return eq_int_type(__c, eof()) ? ~eof() : __c;}
884
+ _LIBCPP_INLINE_VISIBILITY
885
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
886
+ {return char_type(__c);}
887
+ _LIBCPP_INLINE_VISIBILITY
888
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
889
+ {return int_type(__c);}
890
+ _LIBCPP_INLINE_VISIBILITY
891
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
892
+ {return __c1 == __c2;}
893
+ _LIBCPP_INLINE_VISIBILITY
894
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
895
+ {return int_type(0xFFFFFFFF);}
896
+ };
897
+
898
+ inline _LIBCPP_INLINE_VISIBILITY
899
+ int
900
+ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
901
+ {
902
+ for (; __n; --__n, ++__s1, ++__s2)
903
+ {
904
+ if (lt(*__s1, *__s2))
905
+ return -1;
906
+ if (lt(*__s2, *__s1))
907
+ return 1;
908
+ }
909
+ return 0;
910
+ }
911
+
912
+ inline _LIBCPP_INLINE_VISIBILITY
913
+ size_t
914
+ char_traits<char32_t>::length(const char_type* __s)
915
+ {
916
+ size_t __len = 0;
917
+ for (; !eq(*__s, char_type(0)); ++__s)
918
+ ++__len;
919
+ return __len;
920
+ }
921
+
922
+ inline _LIBCPP_INLINE_VISIBILITY
923
+ const char32_t*
924
+ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a)
925
+ {
926
+ for (; __n; --__n)
927
+ {
928
+ if (eq(*__s, __a))
929
+ return __s;
930
+ ++__s;
931
+ }
932
+ return 0;
933
+ }
934
+
935
+ inline _LIBCPP_INLINE_VISIBILITY
936
+ char32_t*
937
+ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
938
+ {
939
+ char_type* __r = __s1;
940
+ if (__s1 < __s2)
941
+ {
942
+ for (; __n; --__n, ++__s1, ++__s2)
943
+ assign(*__s1, *__s2);
944
+ }
945
+ else if (__s2 < __s1)
946
+ {
947
+ __s1 += __n;
948
+ __s2 += __n;
949
+ for (; __n; --__n)
950
+ assign(*--__s1, *--__s2);
951
+ }
952
+ return __r;
953
+ }
954
+
955
+ inline _LIBCPP_INLINE_VISIBILITY
956
+ char32_t*
957
+ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
958
+ {
959
+ char_type* __r = __s1;
960
+ for (; __n; --__n, ++__s1, ++__s2)
961
+ assign(*__s1, *__s2);
962
+ return __r;
963
+ }
964
+
965
+ inline _LIBCPP_INLINE_VISIBILITY
966
+ char32_t*
967
+ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
968
+ {
969
+ char_type* __r = __s;
970
+ for (; __n; --__n, ++__s)
971
+ assign(*__s, __a);
972
+ return __r;
973
+ }
974
+
975
+ #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
976
+
977
+ // basic_string
978
+
979
+ template<class _CharT, class _Traits, class _Allocator>
980
+ basic_string<_CharT, _Traits, _Allocator>
981
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __x,
982
+ const basic_string<_CharT, _Traits, _Allocator>& __y);
983
+
984
+ template<class _CharT, class _Traits, class _Allocator>
985
+ basic_string<_CharT, _Traits, _Allocator>
986
+ operator+(const _CharT* __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
987
+
988
+ template<class _CharT, class _Traits, class _Allocator>
989
+ basic_string<_CharT, _Traits, _Allocator>
990
+ operator+(_CharT __x, const basic_string<_CharT,_Traits,_Allocator>& __y);
991
+
992
+ template<class _CharT, class _Traits, class _Allocator>
993
+ basic_string<_CharT, _Traits, _Allocator>
994
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, const _CharT* __y);
995
+
996
+ template<class _CharT, class _Traits, class _Allocator>
997
+ basic_string<_CharT, _Traits, _Allocator>
998
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
999
+
1000
+ template <bool>
1001
+ class __basic_string_common
1002
+ {
1003
+ protected:
1004
+ void __throw_length_error() const;
1005
+ void __throw_out_of_range() const;
1006
+ };
1007
+
1008
+ template <bool __b>
1009
+ void
1010
+ __basic_string_common<__b>::__throw_length_error() const
1011
+ {
1012
+ #ifndef _LIBCPP_NO_EXCEPTIONS
1013
+ throw length_error("basic_string");
1014
+ #else
1015
+ assert(!"basic_string length_error");
1016
+ #endif
1017
+ }
1018
+
1019
+ template <bool __b>
1020
+ void
1021
+ __basic_string_common<__b>::__throw_out_of_range() const
1022
+ {
1023
+ #ifndef _LIBCPP_NO_EXCEPTIONS
1024
+ throw out_of_range("basic_string");
1025
+ #else
1026
+ assert(!"basic_string out_of_range");
1027
+ #endif
1028
+ }
1029
+
1030
+ #ifdef _MSC_VER
1031
+ #pragma warning( push )
1032
+ #pragma warning( disable: 4231 )
1033
+ #endif // _MSC_VER
1034
+ _LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
1035
+ #ifdef _MSC_VER
1036
+ #pragma warning( pop )
1037
+ #endif // _MSC_VER
1038
+
1039
+ template<class _CharT, class _Traits, class _Allocator>
1040
+ class _LIBCPP_TYPE_VIS basic_string
1041
+ : private __basic_string_common<true>
1042
+ {
1043
+ public:
1044
+ typedef basic_string __self;
1045
+ typedef _Traits traits_type;
1046
+ typedef typename traits_type::char_type value_type;
1047
+ typedef _Allocator allocator_type;
1048
+ typedef allocator_traits<allocator_type> __alloc_traits;
1049
+ typedef typename __alloc_traits::size_type size_type;
1050
+ typedef typename __alloc_traits::difference_type difference_type;
1051
+ typedef value_type& reference;
1052
+ typedef const value_type& const_reference;
1053
+ typedef typename __alloc_traits::pointer pointer;
1054
+ typedef typename __alloc_traits::const_pointer const_pointer;
1055
+ #ifdef _LIBCPP_DEBUG
1056
+ typedef __debug_iter<basic_string, pointer> iterator;
1057
+ typedef __debug_iter<basic_string, const_pointer> const_iterator;
1058
+
1059
+ friend class __debug_iter<basic_string, pointer>;
1060
+ friend class __debug_iter<basic_string, const_pointer>;
1061
+ #elif defined(_LIBCPP_RAW_ITERATORS)
1062
+ typedef pointer iterator;
1063
+ typedef const_pointer const_iterator;
1064
+ #else // defined(_LIBCPP_RAW_ITERATORS)
1065
+ typedef __wrap_iter<pointer> iterator;
1066
+ typedef __wrap_iter<const_pointer> const_iterator;
1067
+ #endif // defined(_LIBCPP_RAW_ITERATORS)
1068
+ typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
1069
+ typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
1070
+
1071
+ private:
1072
+ struct __long
1073
+ {
1074
+ size_type __cap_;
1075
+ size_type __size_;
1076
+ pointer __data_;
1077
+ };
1078
+
1079
+ #if _LIBCPP_BIG_ENDIAN
1080
+ enum {__short_mask = 0x80};
1081
+ enum {__long_mask = ~(size_type(~0) >> 1)};
1082
+ #else // _LIBCPP_BIG_ENDIAN
1083
+ enum {__short_mask = 0x01};
1084
+ enum {__long_mask = 0x1ul};
1085
+ #endif // _LIBCPP_BIG_ENDIAN
1086
+
1087
+ enum {__mask = size_type(~0) >> 1};
1088
+
1089
+ enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
1090
+ (sizeof(__long) - 1)/sizeof(value_type) : 2};
1091
+
1092
+ struct __short
1093
+ {
1094
+ union
1095
+ {
1096
+ unsigned char __size_;
1097
+ value_type __lx;
1098
+ };
1099
+ value_type __data_[__min_cap];
1100
+ };
1101
+
1102
+ union __lx{__long __lx; __short __lxx;};
1103
+
1104
+ enum {__n_words = sizeof(__lx) / sizeof(size_type)};
1105
+
1106
+ struct __raw
1107
+ {
1108
+ size_type __words[__n_words];
1109
+ };
1110
+
1111
+ struct __rep
1112
+ {
1113
+ union
1114
+ {
1115
+ __long __l;
1116
+ __short __s;
1117
+ __raw __r;
1118
+ };
1119
+ };
1120
+
1121
+ __compressed_pair<__rep, allocator_type> __r_;
1122
+
1123
+ #ifdef _LIBCPP_DEBUG
1124
+
1125
+ pair<iterator*, const_iterator*> __iterator_list_;
1126
+
1127
+ _LIBCPP_INLINE_VISIBILITY iterator*& __get_iterator_list(iterator*) {return __iterator_list_.first;}
1128
+ _LIBCPP_INLINE_VISIBILITY const_iterator*& __get_iterator_list(const_iterator*) {return __iterator_list_.second;}
1129
+
1130
+ #endif // _LIBCPP_DEBUG
1131
+
1132
+ public:
1133
+ static const size_type npos = -1;
1134
+
1135
+ _LIBCPP_INLINE_VISIBILITY basic_string()
1136
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
1137
+ _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
1138
+ basic_string(const basic_string& __str);
1139
+ basic_string(const basic_string& __str, const allocator_type& __a);
1140
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1141
+ _LIBCPP_INLINE_VISIBILITY
1142
+ basic_string(basic_string&& __str)
1143
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
1144
+ _LIBCPP_INLINE_VISIBILITY
1145
+ basic_string(basic_string&& __str, const allocator_type& __a);
1146
+ #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1147
+ _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s);
1148
+ _LIBCPP_INLINE_VISIBILITY
1149
+ basic_string(const_pointer __s, const allocator_type& __a);
1150
+ _LIBCPP_INLINE_VISIBILITY
1151
+ basic_string(const_pointer __s, size_type __n);
1152
+ _LIBCPP_INLINE_VISIBILITY
1153
+ basic_string(const_pointer __s, size_type __n, const allocator_type& __a);
1154
+ _LIBCPP_INLINE_VISIBILITY
1155
+ basic_string(size_type __n, value_type __c);
1156
+ _LIBCPP_INLINE_VISIBILITY
1157
+ basic_string(size_type __n, value_type __c, const allocator_type& __a);
1158
+ basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
1159
+ const allocator_type& __a = allocator_type());
1160
+ template<class _InputIterator>
1161
+ _LIBCPP_INLINE_VISIBILITY
1162
+ basic_string(_InputIterator __first, _InputIterator __last);
1163
+ template<class _InputIterator>
1164
+ _LIBCPP_INLINE_VISIBILITY
1165
+ basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
1166
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1167
+ _LIBCPP_INLINE_VISIBILITY
1168
+ basic_string(initializer_list<value_type> __il);
1169
+ _LIBCPP_INLINE_VISIBILITY
1170
+ basic_string(initializer_list<value_type> __il, const allocator_type& __a);
1171
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1172
+
1173
+ ~basic_string();
1174
+
1175
+ basic_string& operator=(const basic_string& __str);
1176
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1177
+ _LIBCPP_INLINE_VISIBILITY
1178
+ basic_string& operator=(basic_string&& __str)
1179
+ _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
1180
+ is_nothrow_move_assignable<allocator_type>::value);
1181
+ #endif
1182
+ _LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
1183
+ basic_string& operator=(value_type __c);
1184
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1185
+ _LIBCPP_INLINE_VISIBILITY
1186
+ basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
1187
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1188
+
1189
+ #ifndef _LIBCPP_DEBUG
1190
+ _LIBCPP_INLINE_VISIBILITY
1191
+ iterator begin() _NOEXCEPT
1192
+ {return iterator(__get_pointer());}
1193
+ _LIBCPP_INLINE_VISIBILITY
1194
+ const_iterator begin() const _NOEXCEPT
1195
+ {return const_iterator(data());}
1196
+ _LIBCPP_INLINE_VISIBILITY
1197
+ iterator end() _NOEXCEPT
1198
+ {return iterator(__get_pointer() + size());}
1199
+ _LIBCPP_INLINE_VISIBILITY
1200
+ const_iterator end() const _NOEXCEPT
1201
+ {return const_iterator(data() + size());}
1202
+ #else // _LIBCPP_DEBUG
1203
+ _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(this, __get_pointer());}
1204
+ _LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(this, data());}
1205
+ _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(this, __get_pointer() + size());}
1206
+ _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(this, data() + size());}
1207
+ #endif // _LIBCPP_DEBUG
1208
+ _LIBCPP_INLINE_VISIBILITY
1209
+ reverse_iterator rbegin() _NOEXCEPT
1210
+ {return reverse_iterator(end());}
1211
+ _LIBCPP_INLINE_VISIBILITY
1212
+ const_reverse_iterator rbegin() const _NOEXCEPT
1213
+ {return const_reverse_iterator(end());}
1214
+ _LIBCPP_INLINE_VISIBILITY
1215
+ reverse_iterator rend() _NOEXCEPT
1216
+ {return reverse_iterator(begin());}
1217
+ _LIBCPP_INLINE_VISIBILITY
1218
+ const_reverse_iterator rend() const _NOEXCEPT
1219
+ {return const_reverse_iterator(begin());}
1220
+
1221
+ _LIBCPP_INLINE_VISIBILITY
1222
+ const_iterator cbegin() const _NOEXCEPT
1223
+ {return begin();}
1224
+ _LIBCPP_INLINE_VISIBILITY
1225
+ const_iterator cend() const _NOEXCEPT
1226
+ {return end();}
1227
+ _LIBCPP_INLINE_VISIBILITY
1228
+ const_reverse_iterator crbegin() const _NOEXCEPT
1229
+ {return rbegin();}
1230
+ _LIBCPP_INLINE_VISIBILITY
1231
+ const_reverse_iterator crend() const _NOEXCEPT
1232
+ {return rend();}
1233
+
1234
+ _LIBCPP_INLINE_VISIBILITY size_type size() const _NOEXCEPT
1235
+ {return __is_long() ? __get_long_size() : __get_short_size();}
1236
+ _LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT {return size();}
1237
+ _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT;
1238
+ _LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT
1239
+ {return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
1240
+
1241
+ void resize(size_type __n, value_type __c);
1242
+ _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
1243
+
1244
+ void reserve(size_type res_arg = 0);
1245
+ _LIBCPP_INLINE_VISIBILITY
1246
+ void shrink_to_fit() _NOEXCEPT {reserve();}
1247
+ _LIBCPP_INLINE_VISIBILITY
1248
+ void clear() _NOEXCEPT;
1249
+ _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT {return size() == 0;}
1250
+
1251
+ _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const;
1252
+ _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __pos);
1253
+
1254
+ const_reference at(size_type __n) const;
1255
+ reference at(size_type __n);
1256
+
1257
+ _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
1258
+ _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const_pointer __s) {return append(__s);}
1259
+ _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
1260
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1261
+ _LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
1262
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1263
+
1264
+ _LIBCPP_INLINE_VISIBILITY
1265
+ basic_string& append(const basic_string& __str);
1266
+ basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
1267
+ basic_string& append(const_pointer __s, size_type __n);
1268
+ basic_string& append(const_pointer __s);
1269
+ basic_string& append(size_type __n, value_type __c);
1270
+ template<class _InputIterator>
1271
+ typename enable_if
1272
+ <
1273
+ __is_input_iterator <_InputIterator>::value &&
1274
+ !__is_forward_iterator<_InputIterator>::value,
1275
+ basic_string&
1276
+ >::type
1277
+ append(_InputIterator __first, _InputIterator __last);
1278
+ template<class _ForwardIterator>
1279
+ typename enable_if
1280
+ <
1281
+ __is_forward_iterator<_ForwardIterator>::value,
1282
+ basic_string&
1283
+ >::type
1284
+ append(_ForwardIterator __first, _ForwardIterator __last);
1285
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1286
+ _LIBCPP_INLINE_VISIBILITY
1287
+ basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
1288
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1289
+
1290
+ void push_back(value_type __c);
1291
+ _LIBCPP_INLINE_VISIBILITY
1292
+ void pop_back();
1293
+ _LIBCPP_INLINE_VISIBILITY reference front();
1294
+ _LIBCPP_INLINE_VISIBILITY const_reference front() const;
1295
+ _LIBCPP_INLINE_VISIBILITY reference back();
1296
+ _LIBCPP_INLINE_VISIBILITY const_reference back() const;
1297
+
1298
+ _LIBCPP_INLINE_VISIBILITY
1299
+ basic_string& assign(const basic_string& __str);
1300
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1301
+ _LIBCPP_INLINE_VISIBILITY
1302
+ basic_string& assign(basic_string&& str)
1303
+ {*this = _VSTD::move(str); return *this;}
1304
+ #endif
1305
+ basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
1306
+ basic_string& assign(const_pointer __s, size_type __n);
1307
+ basic_string& assign(const_pointer __s);
1308
+ basic_string& assign(size_type __n, value_type __c);
1309
+ template<class _InputIterator>
1310
+ typename enable_if
1311
+ <
1312
+ __is_input_iterator <_InputIterator>::value &&
1313
+ !__is_forward_iterator<_InputIterator>::value,
1314
+ basic_string&
1315
+ >::type
1316
+ assign(_InputIterator __first, _InputIterator __last);
1317
+ template<class _ForwardIterator>
1318
+ typename enable_if
1319
+ <
1320
+ __is_forward_iterator<_ForwardIterator>::value,
1321
+ basic_string&
1322
+ >::type
1323
+ assign(_ForwardIterator __first, _ForwardIterator __last);
1324
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1325
+ _LIBCPP_INLINE_VISIBILITY
1326
+ basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
1327
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1328
+
1329
+ _LIBCPP_INLINE_VISIBILITY
1330
+ basic_string& insert(size_type __pos1, const basic_string& __str);
1331
+ basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
1332
+ basic_string& insert(size_type __pos, const_pointer __s, size_type __n);
1333
+ basic_string& insert(size_type __pos, const_pointer __s);
1334
+ basic_string& insert(size_type __pos, size_type __n, value_type __c);
1335
+ iterator insert(const_iterator __pos, value_type __c);
1336
+ _LIBCPP_INLINE_VISIBILITY
1337
+ iterator insert(const_iterator __pos, size_type __n, value_type __c);
1338
+ template<class _InputIterator>
1339
+ typename enable_if
1340
+ <
1341
+ __is_input_iterator <_InputIterator>::value &&
1342
+ !__is_forward_iterator<_InputIterator>::value,
1343
+ iterator
1344
+ >::type
1345
+ insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
1346
+ template<class _ForwardIterator>
1347
+ typename enable_if
1348
+ <
1349
+ __is_forward_iterator<_ForwardIterator>::value,
1350
+ iterator
1351
+ >::type
1352
+ insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
1353
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1354
+ _LIBCPP_INLINE_VISIBILITY
1355
+ iterator insert(const_iterator __pos, initializer_list<value_type> __il)
1356
+ {return insert(__pos, __il.begin(), __il.end());}
1357
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1358
+
1359
+ basic_string& erase(size_type __pos = 0, size_type __n = npos);
1360
+ _LIBCPP_INLINE_VISIBILITY
1361
+ iterator erase(const_iterator __pos);
1362
+ _LIBCPP_INLINE_VISIBILITY
1363
+ iterator erase(const_iterator __first, const_iterator __last);
1364
+
1365
+ _LIBCPP_INLINE_VISIBILITY
1366
+ basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
1367
+ basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
1368
+ basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
1369
+ basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
1370
+ basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
1371
+ _LIBCPP_INLINE_VISIBILITY
1372
+ basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
1373
+ _LIBCPP_INLINE_VISIBILITY
1374
+ basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
1375
+ _LIBCPP_INLINE_VISIBILITY
1376
+ basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
1377
+ _LIBCPP_INLINE_VISIBILITY
1378
+ basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
1379
+ template<class _InputIterator>
1380
+ typename enable_if
1381
+ <
1382
+ __is_input_iterator<_InputIterator>::value,
1383
+ basic_string&
1384
+ >::type
1385
+ replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
1386
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1387
+ _LIBCPP_INLINE_VISIBILITY
1388
+ basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
1389
+ {return replace(__i1, __i2, __il.begin(), __il.end());}
1390
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1391
+
1392
+ size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
1393
+ _LIBCPP_INLINE_VISIBILITY
1394
+ basic_string substr(size_type __pos = 0, size_type __n = npos) const;
1395
+
1396
+ _LIBCPP_INLINE_VISIBILITY
1397
+ void swap(basic_string& __str)
1398
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
1399
+ __is_nothrow_swappable<allocator_type>::value);
1400
+
1401
+ _LIBCPP_INLINE_VISIBILITY
1402
+ const_pointer c_str() const _NOEXCEPT {return data();}
1403
+ _LIBCPP_INLINE_VISIBILITY
1404
+ const_pointer data() const _NOEXCEPT {return __get_pointer();}
1405
+
1406
+ _LIBCPP_INLINE_VISIBILITY
1407
+ allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
1408
+
1409
+ _LIBCPP_INLINE_VISIBILITY
1410
+ size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
1411
+ size_type find(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
1412
+ _LIBCPP_INLINE_VISIBILITY
1413
+ size_type find(const_pointer __s, size_type __pos = 0) const _NOEXCEPT;
1414
+ size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
1415
+
1416
+ _LIBCPP_INLINE_VISIBILITY
1417
+ size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
1418
+ size_type rfind(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
1419
+ _LIBCPP_INLINE_VISIBILITY
1420
+ size_type rfind(const_pointer __s, size_type __pos = npos) const _NOEXCEPT;
1421
+ size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
1422
+
1423
+ _LIBCPP_INLINE_VISIBILITY
1424
+ size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
1425
+ size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
1426
+ _LIBCPP_INLINE_VISIBILITY
1427
+ size_type find_first_of(const_pointer __s, size_type __pos = 0) const _NOEXCEPT;
1428
+ _LIBCPP_INLINE_VISIBILITY
1429
+ size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
1430
+
1431
+ _LIBCPP_INLINE_VISIBILITY
1432
+ size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
1433
+ size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
1434
+ _LIBCPP_INLINE_VISIBILITY
1435
+ size_type find_last_of(const_pointer __s, size_type __pos = npos) const _NOEXCEPT;
1436
+ _LIBCPP_INLINE_VISIBILITY
1437
+ size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
1438
+
1439
+ _LIBCPP_INLINE_VISIBILITY
1440
+ size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
1441
+ size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
1442
+ _LIBCPP_INLINE_VISIBILITY
1443
+ size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const _NOEXCEPT;
1444
+ _LIBCPP_INLINE_VISIBILITY
1445
+ size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
1446
+
1447
+ _LIBCPP_INLINE_VISIBILITY
1448
+ size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
1449
+ size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const _NOEXCEPT;
1450
+ _LIBCPP_INLINE_VISIBILITY
1451
+ size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const _NOEXCEPT;
1452
+ _LIBCPP_INLINE_VISIBILITY
1453
+ size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
1454
+
1455
+ _LIBCPP_INLINE_VISIBILITY
1456
+ int compare(const basic_string& __str) const _NOEXCEPT;
1457
+ _LIBCPP_INLINE_VISIBILITY
1458
+ int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
1459
+ int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
1460
+ int compare(const_pointer __s) const _NOEXCEPT;
1461
+ int compare(size_type __pos1, size_type __n1, const_pointer __s) const;
1462
+ int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
1463
+
1464
+ _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
1465
+ private:
1466
+ _LIBCPP_INLINE_VISIBILITY
1467
+ allocator_type& __alloc() _NOEXCEPT
1468
+ {return __r_.second();}
1469
+ _LIBCPP_INLINE_VISIBILITY
1470
+ const allocator_type& __alloc() const _NOEXCEPT
1471
+ {return __r_.second();}
1472
+
1473
+ _LIBCPP_INLINE_VISIBILITY
1474
+ bool __is_long() const _NOEXCEPT
1475
+ {return bool(__r_.first().__s.__size_ & __short_mask);}
1476
+
1477
+ _LIBCPP_INLINE_VISIBILITY
1478
+ void __set_short_size(size_type __s) _NOEXCEPT
1479
+ #if _LIBCPP_BIG_ENDIAN
1480
+ {__r_.first().__s.__size_ = (unsigned char)(__s);}
1481
+ #else
1482
+ {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
1483
+ #endif
1484
+ _LIBCPP_INLINE_VISIBILITY
1485
+ size_type __get_short_size() const _NOEXCEPT
1486
+ #if _LIBCPP_BIG_ENDIAN
1487
+ {return __r_.first().__s.__size_;}
1488
+ #else
1489
+ {return __r_.first().__s.__size_ >> 1;}
1490
+ #endif
1491
+ _LIBCPP_INLINE_VISIBILITY
1492
+ void __set_long_size(size_type __s) _NOEXCEPT
1493
+ {__r_.first().__l.__size_ = __s;}
1494
+ _LIBCPP_INLINE_VISIBILITY
1495
+ size_type __get_long_size() const _NOEXCEPT
1496
+ {return __r_.first().__l.__size_;}
1497
+ _LIBCPP_INLINE_VISIBILITY
1498
+ void __set_size(size_type __s) _NOEXCEPT
1499
+ {if (__is_long()) __set_long_size(__s); else __set_short_size(__s);}
1500
+
1501
+ _LIBCPP_INLINE_VISIBILITY
1502
+ void __set_long_cap(size_type __s) _NOEXCEPT
1503
+ {__r_.first().__l.__cap_ = __long_mask | __s;}
1504
+ _LIBCPP_INLINE_VISIBILITY
1505
+ size_type __get_long_cap() const _NOEXCEPT
1506
+ {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
1507
+
1508
+ _LIBCPP_INLINE_VISIBILITY
1509
+ void __set_long_pointer(pointer __p) _NOEXCEPT
1510
+ {__r_.first().__l.__data_ = __p;}
1511
+ _LIBCPP_INLINE_VISIBILITY
1512
+ pointer __get_long_pointer() _NOEXCEPT
1513
+ {return __r_.first().__l.__data_;}
1514
+ _LIBCPP_INLINE_VISIBILITY
1515
+ const_pointer __get_long_pointer() const _NOEXCEPT
1516
+ {return __r_.first().__l.__data_;}
1517
+ _LIBCPP_INLINE_VISIBILITY
1518
+ pointer __get_short_pointer() _NOEXCEPT
1519
+ {return __r_.first().__s.__data_;}
1520
+ _LIBCPP_INLINE_VISIBILITY
1521
+ const_pointer __get_short_pointer() const _NOEXCEPT
1522
+ {return __r_.first().__s.__data_;}
1523
+ _LIBCPP_INLINE_VISIBILITY
1524
+ pointer __get_pointer() _NOEXCEPT
1525
+ {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
1526
+ _LIBCPP_INLINE_VISIBILITY
1527
+ const_pointer __get_pointer() const _NOEXCEPT
1528
+ {return __is_long() ? __get_long_pointer() : __get_short_pointer();}
1529
+
1530
+ _LIBCPP_INLINE_VISIBILITY
1531
+ void __zero() _NOEXCEPT
1532
+ {
1533
+ size_type (&__a)[__n_words] = __r_.first().__r.__words;
1534
+ for (unsigned __i = 0; __i < __n_words; ++__i)
1535
+ __a[__i] = 0;
1536
+ }
1537
+
1538
+ template <size_type __a> static
1539
+ _LIBCPP_INLINE_VISIBILITY
1540
+ size_type __align(size_type __s) _NOEXCEPT
1541
+ {return __s + (__a-1) & ~(__a-1);}
1542
+ enum {__alignment = 16};
1543
+ static _LIBCPP_INLINE_VISIBILITY
1544
+ size_type __recommend(size_type __s) _NOEXCEPT
1545
+ {return (__s < __min_cap ? __min_cap :
1546
+ __align<sizeof(value_type) < __alignment ?
1547
+ __alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
1548
+
1549
+ void __init(const_pointer __s, size_type __sz, size_type __reserve);
1550
+ void __init(const_pointer __s, size_type __sz);
1551
+ void __init(size_type __n, value_type __c);
1552
+
1553
+ template <class _InputIterator>
1554
+ typename enable_if
1555
+ <
1556
+ __is_input_iterator <_InputIterator>::value &&
1557
+ !__is_forward_iterator<_InputIterator>::value,
1558
+ void
1559
+ >::type
1560
+ __init(_InputIterator __first, _InputIterator __last);
1561
+
1562
+ template <class _ForwardIterator>
1563
+ typename enable_if
1564
+ <
1565
+ __is_forward_iterator<_ForwardIterator>::value,
1566
+ void
1567
+ >::type
1568
+ __init(_ForwardIterator __first, _ForwardIterator __last);
1569
+
1570
+ void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
1571
+ size_type __n_copy, size_type __n_del, size_type __n_add = 0);
1572
+ void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
1573
+ size_type __n_copy, size_type __n_del,
1574
+ size_type __n_add, const_pointer __p_new_stuff);
1575
+
1576
+ _LIBCPP_INLINE_VISIBILITY
1577
+ void __erase_to_end(size_type __pos);
1578
+
1579
+ _LIBCPP_INLINE_VISIBILITY
1580
+ void __copy_assign_alloc(const basic_string& __str)
1581
+ {__copy_assign_alloc(__str, integral_constant<bool,
1582
+ __alloc_traits::propagate_on_container_copy_assignment::value>());}
1583
+
1584
+ _LIBCPP_INLINE_VISIBILITY
1585
+ void __copy_assign_alloc(const basic_string& __str, true_type)
1586
+ {
1587
+ if (__alloc() != __str.__alloc())
1588
+ {
1589
+ clear();
1590
+ shrink_to_fit();
1591
+ }
1592
+ __alloc() = __str.__alloc();
1593
+ }
1594
+
1595
+ _LIBCPP_INLINE_VISIBILITY
1596
+ void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
1597
+ {}
1598
+
1599
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1600
+ _LIBCPP_INLINE_VISIBILITY
1601
+ void __move_assign(basic_string& __str, false_type);
1602
+ _LIBCPP_INLINE_VISIBILITY
1603
+ void __move_assign(basic_string& __str, true_type)
1604
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
1605
+ #endif
1606
+
1607
+ _LIBCPP_INLINE_VISIBILITY
1608
+ void
1609
+ __move_assign_alloc(basic_string& __str)
1610
+ _NOEXCEPT_(
1611
+ !__alloc_traits::propagate_on_container_move_assignment::value ||
1612
+ is_nothrow_move_assignable<allocator_type>::value)
1613
+ {__move_assign_alloc(__str, integral_constant<bool,
1614
+ __alloc_traits::propagate_on_container_move_assignment::value>());}
1615
+
1616
+ _LIBCPP_INLINE_VISIBILITY
1617
+ void __move_assign_alloc(basic_string& __c, true_type)
1618
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
1619
+ {
1620
+ __alloc() = _VSTD::move(__c.__alloc());
1621
+ }
1622
+
1623
+ _LIBCPP_INLINE_VISIBILITY
1624
+ void __move_assign_alloc(basic_string&, false_type)
1625
+ _NOEXCEPT
1626
+ {}
1627
+
1628
+ _LIBCPP_INLINE_VISIBILITY
1629
+ static void __swap_alloc(allocator_type& __x, allocator_type& __y)
1630
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
1631
+ __is_nothrow_swappable<allocator_type>::value)
1632
+ {__swap_alloc(__x, __y, integral_constant<bool,
1633
+ __alloc_traits::propagate_on_container_swap::value>());}
1634
+
1635
+ _LIBCPP_INLINE_VISIBILITY
1636
+ static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
1637
+ _NOEXCEPT_(__is_nothrow_swappable<allocator_type>::value)
1638
+ {
1639
+ using _VSTD::swap;
1640
+ swap(__x, __y);
1641
+ }
1642
+ _LIBCPP_INLINE_VISIBILITY
1643
+ static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT
1644
+ {}
1645
+
1646
+ _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
1647
+ _LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
1648
+
1649
+ friend basic_string operator+<>(const basic_string&, const basic_string&);
1650
+ friend basic_string operator+<>(const value_type*, const basic_string&);
1651
+ friend basic_string operator+<>(value_type, const basic_string&);
1652
+ friend basic_string operator+<>(const basic_string&, const value_type*);
1653
+ friend basic_string operator+<>(const basic_string&, value_type);
1654
+ };
1655
+
1656
+ template <class _CharT, class _Traits, class _Allocator>
1657
+ #ifndef _LIBCPP_DEBUG
1658
+ _LIBCPP_INLINE_VISIBILITY inline
1659
+ #endif
1660
+ void
1661
+ basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
1662
+ {
1663
+ #ifdef _LIBCPP_DEBUG
1664
+ iterator::__remove_all(this);
1665
+ const_iterator::__remove_all(this);
1666
+ #endif // _LIBCPP_DEBUG
1667
+ }
1668
+
1669
+ template <class _CharT, class _Traits, class _Allocator>
1670
+ #ifndef _LIBCPP_DEBUG
1671
+ _LIBCPP_INLINE_VISIBILITY inline
1672
+ #endif
1673
+ void
1674
+ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
1675
+ #ifdef _LIBCPP_DEBUG
1676
+ __pos
1677
+ #endif
1678
+ )
1679
+ {
1680
+ #ifdef _LIBCPP_DEBUG
1681
+ const_iterator __beg = begin();
1682
+ if (__iterator_list_.first)
1683
+ {
1684
+ for (iterator* __p = __iterator_list_.first; __p;)
1685
+ {
1686
+ if (*__p - __beg > static_cast<difference_type>(__pos))
1687
+ {
1688
+ iterator* __n = __p;
1689
+ __p = __p->__next;
1690
+ __n->__remove_owner();
1691
+ }
1692
+ else
1693
+ __p = __p->__next;
1694
+ }
1695
+ }
1696
+ if (__iterator_list_.second)
1697
+ {
1698
+ for (const_iterator* __p = __iterator_list_.second; __p;)
1699
+ {
1700
+ if (*__p - __beg > static_cast<difference_type>(__pos))
1701
+ {
1702
+ const_iterator* __n = __p;
1703
+ __p = __p->__next;
1704
+ __n->__remove_owner();
1705
+ }
1706
+ else
1707
+ __p = __p->__next;
1708
+ }
1709
+ }
1710
+ #endif // _LIBCPP_DEBUG
1711
+ }
1712
+
1713
+ template <class _CharT, class _Traits, class _Allocator>
1714
+ _LIBCPP_INLINE_VISIBILITY inline
1715
+ basic_string<_CharT, _Traits, _Allocator>::basic_string()
1716
+ _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
1717
+ {
1718
+ __zero();
1719
+ }
1720
+
1721
+ template <class _CharT, class _Traits, class _Allocator>
1722
+ _LIBCPP_INLINE_VISIBILITY inline
1723
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
1724
+ : __r_(__a)
1725
+ {
1726
+ __zero();
1727
+ }
1728
+
1729
+ template <class _CharT, class _Traits, class _Allocator>
1730
+ void
1731
+ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type __sz, size_type __reserve)
1732
+ {
1733
+ if (__reserve > max_size())
1734
+ this->__throw_length_error();
1735
+ pointer __p;
1736
+ if (__reserve < __min_cap)
1737
+ {
1738
+ __set_short_size(__sz);
1739
+ __p = __get_short_pointer();
1740
+ }
1741
+ else
1742
+ {
1743
+ size_type __cap = __recommend(__reserve);
1744
+ __p = __alloc_traits::allocate(__alloc(), __cap+1);
1745
+ __set_long_pointer(__p);
1746
+ __set_long_cap(__cap+1);
1747
+ __set_long_size(__sz);
1748
+ }
1749
+ traits_type::copy(__p, __s, __sz);
1750
+ traits_type::assign(__p[__sz], value_type());
1751
+ }
1752
+
1753
+ template <class _CharT, class _Traits, class _Allocator>
1754
+ void
1755
+ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type __sz)
1756
+ {
1757
+ if (__sz > max_size())
1758
+ this->__throw_length_error();
1759
+ pointer __p;
1760
+ if (__sz < __min_cap)
1761
+ {
1762
+ __set_short_size(__sz);
1763
+ __p = __get_short_pointer();
1764
+ }
1765
+ else
1766
+ {
1767
+ size_type __cap = __recommend(__sz);
1768
+ __p = __alloc_traits::allocate(__alloc(), __cap+1);
1769
+ __set_long_pointer(__p);
1770
+ __set_long_cap(__cap+1);
1771
+ __set_long_size(__sz);
1772
+ }
1773
+ traits_type::copy(__p, __s, __sz);
1774
+ traits_type::assign(__p[__sz], value_type());
1775
+ }
1776
+
1777
+ template <class _CharT, class _Traits, class _Allocator>
1778
+ _LIBCPP_INLINE_VISIBILITY inline
1779
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s)
1780
+ {
1781
+ #ifdef _LIBCPP_DEBUG
1782
+ assert(__s != 0);
1783
+ #endif
1784
+ __init(__s, traits_type::length(__s));
1785
+ }
1786
+
1787
+ template <class _CharT, class _Traits, class _Allocator>
1788
+ _LIBCPP_INLINE_VISIBILITY inline
1789
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, const allocator_type& __a)
1790
+ : __r_(__a)
1791
+ {
1792
+ #ifdef _LIBCPP_DEBUG
1793
+ assert(__s != 0);
1794
+ #endif
1795
+ __init(__s, traits_type::length(__s));
1796
+ }
1797
+
1798
+ template <class _CharT, class _Traits, class _Allocator>
1799
+ _LIBCPP_INLINE_VISIBILITY inline
1800
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_type __n)
1801
+ {
1802
+ #ifdef _LIBCPP_DEBUG
1803
+ assert(__s != 0);
1804
+ #endif
1805
+ __init(__s, __n);
1806
+ }
1807
+
1808
+ template <class _CharT, class _Traits, class _Allocator>
1809
+ _LIBCPP_INLINE_VISIBILITY inline
1810
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_type __n, const allocator_type& __a)
1811
+ : __r_(__a)
1812
+ {
1813
+ #ifdef _LIBCPP_DEBUG
1814
+ assert(__s != 0);
1815
+ #endif
1816
+ __init(__s, __n);
1817
+ }
1818
+
1819
+ template <class _CharT, class _Traits, class _Allocator>
1820
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
1821
+ : __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
1822
+ {
1823
+ if (!__str.__is_long())
1824
+ __r_.first().__r = __str.__r_.first().__r;
1825
+ else
1826
+ __init(__str.__get_long_pointer(), __str.__get_long_size());
1827
+ }
1828
+
1829
+ template <class _CharT, class _Traits, class _Allocator>
1830
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, const allocator_type& __a)
1831
+ : __r_(__a)
1832
+ {
1833
+ if (!__str.__is_long())
1834
+ __r_.first().__r = __str.__r_.first().__r;
1835
+ else
1836
+ __init(__str.__get_long_pointer(), __str.__get_long_size());
1837
+ }
1838
+
1839
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1840
+
1841
+ template <class _CharT, class _Traits, class _Allocator>
1842
+ _LIBCPP_INLINE_VISIBILITY inline
1843
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
1844
+ _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
1845
+ : __r_(_VSTD::move(__str.__r_))
1846
+ {
1847
+ __str.__zero();
1848
+ #ifdef _LIBCPP_DEBUG
1849
+ __str.__invalidate_all_iterators();
1850
+ #endif
1851
+ }
1852
+
1853
+ template <class _CharT, class _Traits, class _Allocator>
1854
+ _LIBCPP_INLINE_VISIBILITY inline
1855
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
1856
+ : __r_(__a)
1857
+ {
1858
+ if (__a == __str.__alloc() || !__str.__is_long())
1859
+ __r_.first().__r = __str.__r_.first().__r;
1860
+ else
1861
+ __init(__str.__get_long_pointer(), __str.__get_long_size());
1862
+ __str.__zero();
1863
+ #ifdef _LIBCPP_DEBUG
1864
+ __str.__invalidate_all_iterators();
1865
+ #endif
1866
+ }
1867
+
1868
+ #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
1869
+
1870
+ template <class _CharT, class _Traits, class _Allocator>
1871
+ void
1872
+ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
1873
+ {
1874
+ if (__n > max_size())
1875
+ this->__throw_length_error();
1876
+ pointer __p;
1877
+ if (__n < __min_cap)
1878
+ {
1879
+ __set_short_size(__n);
1880
+ __p = __get_short_pointer();
1881
+ }
1882
+ else
1883
+ {
1884
+ size_type __cap = __recommend(__n);
1885
+ __p = __alloc_traits::allocate(__alloc(), __cap+1);
1886
+ __set_long_pointer(__p);
1887
+ __set_long_cap(__cap+1);
1888
+ __set_long_size(__n);
1889
+ }
1890
+ traits_type::assign(__p, __n, __c);
1891
+ traits_type::assign(__p[__n], value_type());
1892
+ }
1893
+
1894
+ template <class _CharT, class _Traits, class _Allocator>
1895
+ _LIBCPP_INLINE_VISIBILITY inline
1896
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c)
1897
+ {
1898
+ __init(__n, __c);
1899
+ }
1900
+
1901
+ template <class _CharT, class _Traits, class _Allocator>
1902
+ _LIBCPP_INLINE_VISIBILITY inline
1903
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c, const allocator_type& __a)
1904
+ : __r_(__a)
1905
+ {
1906
+ __init(__n, __c);
1907
+ }
1908
+
1909
+ template <class _CharT, class _Traits, class _Allocator>
1910
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n,
1911
+ const allocator_type& __a)
1912
+ : __r_(__a)
1913
+ {
1914
+ size_type __str_sz = __str.size();
1915
+ if (__pos > __str_sz)
1916
+ this->__throw_out_of_range();
1917
+ __init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
1918
+ }
1919
+
1920
+ template <class _CharT, class _Traits, class _Allocator>
1921
+ template <class _InputIterator>
1922
+ typename enable_if
1923
+ <
1924
+ __is_input_iterator <_InputIterator>::value &&
1925
+ !__is_forward_iterator<_InputIterator>::value,
1926
+ void
1927
+ >::type
1928
+ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
1929
+ {
1930
+ __zero();
1931
+ #ifndef _LIBCPP_NO_EXCEPTIONS
1932
+ try
1933
+ {
1934
+ #endif // _LIBCPP_NO_EXCEPTIONS
1935
+ for (; __first != __last; ++__first)
1936
+ push_back(*__first);
1937
+ #ifndef _LIBCPP_NO_EXCEPTIONS
1938
+ }
1939
+ catch (...)
1940
+ {
1941
+ if (__is_long())
1942
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
1943
+ throw;
1944
+ }
1945
+ #endif // _LIBCPP_NO_EXCEPTIONS
1946
+ }
1947
+
1948
+ template <class _CharT, class _Traits, class _Allocator>
1949
+ template <class _ForwardIterator>
1950
+ typename enable_if
1951
+ <
1952
+ __is_forward_iterator<_ForwardIterator>::value,
1953
+ void
1954
+ >::type
1955
+ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last)
1956
+ {
1957
+ size_type __sz = static_cast<size_type>(_VSTD::distance(__first, __last));
1958
+ if (__sz > max_size())
1959
+ this->__throw_length_error();
1960
+ pointer __p;
1961
+ if (__sz < __min_cap)
1962
+ {
1963
+ __set_short_size(__sz);
1964
+ __p = __get_short_pointer();
1965
+ }
1966
+ else
1967
+ {
1968
+ size_type __cap = __recommend(__sz);
1969
+ __p = __alloc_traits::allocate(__alloc(), __cap+1);
1970
+ __set_long_pointer(__p);
1971
+ __set_long_cap(__cap+1);
1972
+ __set_long_size(__sz);
1973
+ }
1974
+ for (; __first != __last; ++__first, ++__p)
1975
+ traits_type::assign(*__p, *__first);
1976
+ traits_type::assign(*__p, value_type());
1977
+ }
1978
+
1979
+ template <class _CharT, class _Traits, class _Allocator>
1980
+ template<class _InputIterator>
1981
+ _LIBCPP_INLINE_VISIBILITY inline
1982
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last)
1983
+ {
1984
+ __init(__first, __last);
1985
+ }
1986
+
1987
+ template <class _CharT, class _Traits, class _Allocator>
1988
+ template<class _InputIterator>
1989
+ _LIBCPP_INLINE_VISIBILITY inline
1990
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
1991
+ const allocator_type& __a)
1992
+ : __r_(__a)
1993
+ {
1994
+ __init(__first, __last);
1995
+ }
1996
+
1997
+ #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
1998
+
1999
+ template <class _CharT, class _Traits, class _Allocator>
2000
+ _LIBCPP_INLINE_VISIBILITY inline
2001
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il)
2002
+ {
2003
+ __init(__il.begin(), __il.end());
2004
+ }
2005
+
2006
+ template <class _CharT, class _Traits, class _Allocator>
2007
+ _LIBCPP_INLINE_VISIBILITY inline
2008
+ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il, const allocator_type& __a)
2009
+ : __r_(__a)
2010
+ {
2011
+ __init(__il.begin(), __il.end());
2012
+ }
2013
+
2014
+ #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
2015
+
2016
+ template <class _CharT, class _Traits, class _Allocator>
2017
+ basic_string<_CharT, _Traits, _Allocator>::~basic_string()
2018
+ {
2019
+ __invalidate_all_iterators();
2020
+ if (__is_long())
2021
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
2022
+ }
2023
+
2024
+ template <class _CharT, class _Traits, class _Allocator>
2025
+ void
2026
+ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
2027
+ (size_type __old_cap, size_type __delta_cap, size_type __old_sz,
2028
+ size_type __n_copy, size_type __n_del, size_type __n_add, const_pointer __p_new_stuff)
2029
+ {
2030
+ size_type __ms = max_size();
2031
+ if (__delta_cap > __ms - __old_cap - 1)
2032
+ this->__throw_length_error();
2033
+ pointer __old_p = __get_pointer();
2034
+ size_type __cap = __old_cap < __ms / 2 - __alignment ?
2035
+ __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
2036
+ __ms - 1;
2037
+ pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2038
+ __invalidate_all_iterators();
2039
+ if (__n_copy != 0)
2040
+ traits_type::copy(__p, __old_p, __n_copy);
2041
+ if (__n_add != 0)
2042
+ traits_type::copy(__p + __n_copy, __p_new_stuff, __n_add);
2043
+ size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2044
+ if (__sec_cp_sz != 0)
2045
+ traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
2046
+ if (__old_cap+1 != __min_cap)
2047
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2048
+ __set_long_pointer(__p);
2049
+ __set_long_cap(__cap+1);
2050
+ __old_sz = __n_copy + __n_add + __sec_cp_sz;
2051
+ __set_long_size(__old_sz);
2052
+ traits_type::assign(__p[__old_sz], value_type());
2053
+ }
2054
+
2055
+ template <class _CharT, class _Traits, class _Allocator>
2056
+ void
2057
+ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
2058
+ size_type __n_copy, size_type __n_del, size_type __n_add)
2059
+ {
2060
+ size_type __ms = max_size();
2061
+ if (__delta_cap > __ms - __old_cap - 1)
2062
+ this->__throw_length_error();
2063
+ pointer __old_p = __get_pointer();
2064
+ size_type __cap = __old_cap < __ms / 2 - __alignment ?
2065
+ __recommend(_VSTD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
2066
+ __ms - 1;
2067
+ pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
2068
+ __invalidate_all_iterators();
2069
+ if (__n_copy != 0)
2070
+ traits_type::copy(__p, __old_p, __n_copy);
2071
+ size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
2072
+ if (__sec_cp_sz != 0)
2073
+ traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
2074
+ if (__old_cap+1 != __min_cap)
2075
+ __alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
2076
+ __set_long_pointer(__p);
2077
+ __set_long_cap(__cap+1);
2078
+ }
2079
+
2080
+ // assign
2081
+
2082
+ template <class _CharT, class _Traits, class _Allocator>
2083
+ basic_string<_CharT, _Traits, _Allocator>&
2084
+ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s, size_type __n)
2085
+ {
2086
+ #ifdef _LIBCPP_DEBUG
2087
+ assert(__s != 0);
2088
+ #endif
2089
+ size_type __cap = capacity();
2090
+ if (__cap >= __n)
2091
+ {
2092
+ pointer __p = __get_pointer();
2093
+ traits_type::move(__p, __s, __n);
2094
+ traits_type::assign(__p[__n], value_type());
2095
+ __set_size(__n);
2096
+ __invalidate_iterators_past(__n);
2097
+ }
2098
+ else
2099
+ {
2100
+ size_type __sz = size();
2101
+ __grow_by_and_replace(__cap, __n - __cap, __sz, 0, __sz, __n, __s);
2102
+ }
2103
+ return *this;
2104
+ }
2105
+
2106
+ template <class _CharT, class _Traits, class _Allocator>
2107
+ basic_string<_CharT, _Traits, _Allocator>&
2108
+ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
2109
+ {
2110
+ size_type __cap = capacity();
2111
+ if (__cap < __n)
2112
+ {
2113
+ size_type __sz = size();
2114
+ __grow_by(__cap, __n - __cap, __sz, 0, __sz);
2115
+ }
2116
+ else
2117
+ __invalidate_iterators_past(__n);
2118
+ pointer __p = __get_pointer();
2119
+ traits_type::assign(__p, __n, __c);
2120
+ traits_type::assign(__p[__n], value_type());
2121
+ __set_size(__n);
2122
+ return *this;
2123
+ }
2124
+
2125
+ template <class _CharT, class _Traits, class _Allocator>
2126
+ basic_string<_CharT, _Traits, _Allocator>&
2127
+ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
2128
+ {
2129
+ pointer __p;
2130
+ if (__is_long())
2131
+ {
2132
+ __p = __get_long_pointer();
2133
+ __set_long_size(1);
2134
+ }
2135
+ else
2136
+ {
2137
+ __p = __get_short_pointer();
2138
+ __set_short_size(1);
2139
+ }
2140
+ traits_type::assign(*__p, __c);
2141
+ traits_type::assign(*++__p, value_type());
2142
+ __invalidate_iterators_past(1);
2143
+ return *this;
2144
+ }
2145
+
2146
+ template <class _CharT, class _Traits, class _Allocator>
2147
+ basic_string<_CharT, _Traits, _Allocator>&
2148
+ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
2149
+ {
2150
+ if (this != &__str)
2151
+ {
2152
+ __copy_assign_alloc(__str);
2153
+ assign(__str);
2154
+ }
2155
+ return *this;
2156
+ }
2157
+
2158
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
2159
+
2160
+ template <class _CharT, class _Traits, class _Allocator>
2161
+ _LIBCPP_INLINE_VISIBILITY inline
2162
+ void
2163
+ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
2164
+ {
2165
+ if (__alloc() != __str.__alloc())
2166
+ assign(__str);
2167
+ else
2168
+ __move_assign(__str, true_type());
2169
+ }
2170
+
2171
+ template <class _CharT, class _Traits, class _Allocator>
2172
+ _LIBCPP_INLINE_VISIBILITY inline
2173
+ void
2174
+ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
2175
+ _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
2176
+ {
2177
+ clear();
2178
+ shrink_to_fit();
2179
+ __r_.first() = __str.__r_.first();
2180
+ __move_assign_alloc(__str);
2181
+ __str.__zero();
2182
+ }
2183
+
2184
+ template <class _CharT, class _Traits, class _Allocator>
2185
+ _LIBCPP_INLINE_VISIBILITY inline
2186
+ basic_string<_CharT, _Traits, _Allocator>&
2187
+ basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
2188
+ _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
2189
+ is_nothrow_move_assignable<allocator_type>::value)
2190
+ {
2191
+ __move_assign(__str, integral_constant<bool,
2192
+ __alloc_traits::propagate_on_container_move_assignment::value>());
2193
+ return *this;
2194
+ }
2195
+
2196
+ #endif
2197
+
2198
+ template <class _CharT, class _Traits, class _Allocator>
2199
+ template<class _InputIterator>
2200
+ typename enable_if
2201
+ <
2202
+ __is_input_iterator <_InputIterator>::value &&
2203
+ !__is_forward_iterator<_InputIterator>::value,
2204
+ basic_string<_CharT, _Traits, _Allocator>&
2205
+ >::type
2206
+ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
2207
+ {
2208
+ clear();
2209
+ for (; __first != __last; ++__first)
2210
+ push_back(*__first);
2211
+ return *this;
2212
+ }
2213
+
2214
+ template <class _CharT, class _Traits, class _Allocator>
2215
+ template<class _ForwardIterator>
2216
+ typename enable_if
2217
+ <
2218
+ __is_forward_iterator<_ForwardIterator>::value,
2219
+ basic_string<_CharT, _Traits, _Allocator>&
2220
+ >::type
2221
+ basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
2222
+ {
2223
+ size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2224
+ size_type __cap = capacity();
2225
+ if (__cap < __n)
2226
+ {
2227
+ size_type __sz = size();
2228
+ __grow_by(__cap, __n - __cap, __sz, 0, __sz);
2229
+ }
2230
+ else
2231
+ __invalidate_iterators_past(__n);
2232
+ pointer __p = __get_pointer();
2233
+ for (; __first != __last; ++__first, ++__p)
2234
+ traits_type::assign(*__p, *__first);
2235
+ traits_type::assign(*__p, value_type());
2236
+ __set_size(__n);
2237
+ return *this;
2238
+ }
2239
+
2240
+ template <class _CharT, class _Traits, class _Allocator>
2241
+ _LIBCPP_INLINE_VISIBILITY inline
2242
+ basic_string<_CharT, _Traits, _Allocator>&
2243
+ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str)
2244
+ {
2245
+ return assign(__str.data(), __str.size());
2246
+ }
2247
+
2248
+ template <class _CharT, class _Traits, class _Allocator>
2249
+ basic_string<_CharT, _Traits, _Allocator>&
2250
+ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n)
2251
+ {
2252
+ size_type __sz = __str.size();
2253
+ if (__pos > __sz)
2254
+ this->__throw_out_of_range();
2255
+ return assign(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
2256
+ }
2257
+
2258
+ template <class _CharT, class _Traits, class _Allocator>
2259
+ basic_string<_CharT, _Traits, _Allocator>&
2260
+ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s)
2261
+ {
2262
+ #ifdef _LIBCPP_DEBUG
2263
+ assert(__s != 0);
2264
+ #endif
2265
+ return assign(__s, traits_type::length(__s));
2266
+ }
2267
+
2268
+ // append
2269
+
2270
+ template <class _CharT, class _Traits, class _Allocator>
2271
+ basic_string<_CharT, _Traits, _Allocator>&
2272
+ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s, size_type __n)
2273
+ {
2274
+ #ifdef _LIBCPP_DEBUG
2275
+ assert(__s != 0);
2276
+ #endif
2277
+ size_type __cap = capacity();
2278
+ size_type __sz = size();
2279
+ if (__cap - __sz >= __n)
2280
+ {
2281
+ if (__n)
2282
+ {
2283
+ pointer __p = __get_pointer();
2284
+ traits_type::copy(__p + __sz, __s, __n);
2285
+ __sz += __n;
2286
+ __set_size(__sz);
2287
+ traits_type::assign(__p[__sz], value_type());
2288
+ }
2289
+ }
2290
+ else
2291
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __sz, 0, __n, __s);
2292
+ return *this;
2293
+ }
2294
+
2295
+ template <class _CharT, class _Traits, class _Allocator>
2296
+ basic_string<_CharT, _Traits, _Allocator>&
2297
+ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
2298
+ {
2299
+ if (__n)
2300
+ {
2301
+ size_type __cap = capacity();
2302
+ size_type __sz = size();
2303
+ if (__cap - __sz < __n)
2304
+ __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2305
+ pointer __p = __get_pointer();
2306
+ traits_type::assign(__p + __sz, __n, __c);
2307
+ __sz += __n;
2308
+ __set_size(__sz);
2309
+ traits_type::assign(__p[__sz], value_type());
2310
+ }
2311
+ return *this;
2312
+ }
2313
+
2314
+ template <class _CharT, class _Traits, class _Allocator>
2315
+ void
2316
+ basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
2317
+ {
2318
+ size_type __cap = capacity();
2319
+ size_type __sz = size();
2320
+ if (__sz == __cap)
2321
+ __grow_by(__cap, 1, __sz, __sz, 0);
2322
+ pointer __p = __get_pointer() + __sz;
2323
+ traits_type::assign(*__p, __c);
2324
+ traits_type::assign(*++__p, value_type());
2325
+ __set_size(__sz+1);
2326
+ }
2327
+
2328
+ template <class _CharT, class _Traits, class _Allocator>
2329
+ template<class _InputIterator>
2330
+ typename enable_if
2331
+ <
2332
+ __is_input_iterator <_InputIterator>::value &&
2333
+ !__is_forward_iterator<_InputIterator>::value,
2334
+ basic_string<_CharT, _Traits, _Allocator>&
2335
+ >::type
2336
+ basic_string<_CharT, _Traits, _Allocator>::append(_InputIterator __first, _InputIterator __last)
2337
+ {
2338
+ for (; __first != __last; ++__first)
2339
+ push_back(*__first);
2340
+ return *this;
2341
+ }
2342
+
2343
+ template <class _CharT, class _Traits, class _Allocator>
2344
+ template<class _ForwardIterator>
2345
+ typename enable_if
2346
+ <
2347
+ __is_forward_iterator<_ForwardIterator>::value,
2348
+ basic_string<_CharT, _Traits, _Allocator>&
2349
+ >::type
2350
+ basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _ForwardIterator __last)
2351
+ {
2352
+ size_type __sz = size();
2353
+ size_type __cap = capacity();
2354
+ size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2355
+ if (__n)
2356
+ {
2357
+ if (__cap - __sz < __n)
2358
+ __grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
2359
+ pointer __p = __get_pointer() + __sz;
2360
+ for (; __first != __last; ++__p, ++__first)
2361
+ traits_type::assign(*__p, *__first);
2362
+ traits_type::assign(*__p, value_type());
2363
+ __set_size(__sz + __n);
2364
+ }
2365
+ return *this;
2366
+ }
2367
+
2368
+ template <class _CharT, class _Traits, class _Allocator>
2369
+ _LIBCPP_INLINE_VISIBILITY inline
2370
+ basic_string<_CharT, _Traits, _Allocator>&
2371
+ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str)
2372
+ {
2373
+ return append(__str.data(), __str.size());
2374
+ }
2375
+
2376
+ template <class _CharT, class _Traits, class _Allocator>
2377
+ basic_string<_CharT, _Traits, _Allocator>&
2378
+ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n)
2379
+ {
2380
+ size_type __sz = __str.size();
2381
+ if (__pos > __sz)
2382
+ this->__throw_out_of_range();
2383
+ return append(__str.data() + __pos, _VSTD::min(__n, __sz - __pos));
2384
+ }
2385
+
2386
+ template <class _CharT, class _Traits, class _Allocator>
2387
+ basic_string<_CharT, _Traits, _Allocator>&
2388
+ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s)
2389
+ {
2390
+ #ifdef _LIBCPP_DEBUG
2391
+ assert(__s != 0);
2392
+ #endif
2393
+ return append(__s, traits_type::length(__s));
2394
+ }
2395
+
2396
+ // insert
2397
+
2398
+ template <class _CharT, class _Traits, class _Allocator>
2399
+ basic_string<_CharT, _Traits, _Allocator>&
2400
+ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer __s, size_type __n)
2401
+ {
2402
+ #ifdef _LIBCPP_DEBUG
2403
+ assert(__s != 0);
2404
+ #endif
2405
+ size_type __sz = size();
2406
+ if (__pos > __sz)
2407
+ this->__throw_out_of_range();
2408
+ size_type __cap = capacity();
2409
+ if (__cap - __sz >= __n)
2410
+ {
2411
+ if (__n)
2412
+ {
2413
+ pointer __p = __get_pointer();
2414
+ size_type __n_move = __sz - __pos;
2415
+ if (__n_move != 0)
2416
+ {
2417
+ if (__p + __pos <= __s && __s < __p + __sz)
2418
+ __s += __n;
2419
+ traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
2420
+ }
2421
+ traits_type::move(__p + __pos, __s, __n);
2422
+ __sz += __n;
2423
+ __set_size(__sz);
2424
+ traits_type::assign(__p[__sz], value_type());
2425
+ }
2426
+ }
2427
+ else
2428
+ __grow_by_and_replace(__cap, __sz + __n - __cap, __sz, __pos, 0, __n, __s);
2429
+ return *this;
2430
+ }
2431
+
2432
+ template <class _CharT, class _Traits, class _Allocator>
2433
+ basic_string<_CharT, _Traits, _Allocator>&
2434
+ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c)
2435
+ {
2436
+ size_type __sz = size();
2437
+ if (__pos > __sz)
2438
+ this->__throw_out_of_range();
2439
+ if (__n)
2440
+ {
2441
+ size_type __cap = capacity();
2442
+ pointer __p;
2443
+ if (__cap - __sz >= __n)
2444
+ {
2445
+ __p = __get_pointer();
2446
+ size_type __n_move = __sz - __pos;
2447
+ if (__n_move != 0)
2448
+ traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
2449
+ }
2450
+ else
2451
+ {
2452
+ __grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
2453
+ __p = __get_long_pointer();
2454
+ }
2455
+ traits_type::assign(__p + __pos, __n, __c);
2456
+ __sz += __n;
2457
+ __set_size(__sz);
2458
+ traits_type::assign(__p[__sz], value_type());
2459
+ }
2460
+ return *this;
2461
+ }
2462
+
2463
+ template <class _CharT, class _Traits, class _Allocator>
2464
+ template<class _InputIterator>
2465
+ typename enable_if
2466
+ <
2467
+ __is_input_iterator <_InputIterator>::value &&
2468
+ !__is_forward_iterator<_InputIterator>::value,
2469
+ typename basic_string<_CharT, _Traits, _Allocator>::iterator
2470
+ >::type
2471
+ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
2472
+ {
2473
+ size_type __old_sz = size();
2474
+ difference_type __ip = __pos - begin();
2475
+ for (; __first != __last; ++__first)
2476
+ push_back(*__first);
2477
+ pointer __p = __get_pointer();
2478
+ _VSTD::rotate(__p + __ip, __p + __old_sz, __p + size());
2479
+ return iterator(__p + __ip);
2480
+ }
2481
+
2482
+ template <class _CharT, class _Traits, class _Allocator>
2483
+ template<class _ForwardIterator>
2484
+ typename enable_if
2485
+ <
2486
+ __is_forward_iterator<_ForwardIterator>::value,
2487
+ typename basic_string<_CharT, _Traits, _Allocator>::iterator
2488
+ >::type
2489
+ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
2490
+ {
2491
+ size_type __ip = static_cast<size_type>(__pos - begin());
2492
+ size_type __sz = size();
2493
+ size_type __cap = capacity();
2494
+ size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
2495
+ if (__n)
2496
+ {
2497
+ pointer __p;
2498
+ if (__cap - __sz >= __n)
2499
+ {
2500
+ __p = __get_pointer();
2501
+ size_type __n_move = __sz - __ip;
2502
+ if (__n_move != 0)
2503
+ traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
2504
+ }
2505
+ else
2506
+ {
2507
+ __grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
2508
+ __p = __get_long_pointer();
2509
+ }
2510
+ __sz += __n;
2511
+ __set_size(__sz);
2512
+ traits_type::assign(__p[__sz], value_type());
2513
+ for (__p += __ip; __first != __last; ++__p, ++__first)
2514
+ traits_type::assign(*__p, *__first);
2515
+ }
2516
+ return begin() + __ip;
2517
+ }
2518
+
2519
+ template <class _CharT, class _Traits, class _Allocator>
2520
+ _LIBCPP_INLINE_VISIBILITY inline
2521
+ basic_string<_CharT, _Traits, _Allocator>&
2522
+ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str)
2523
+ {
2524
+ return insert(__pos1, __str.data(), __str.size());
2525
+ }
2526
+
2527
+ template <class _CharT, class _Traits, class _Allocator>
2528
+ basic_string<_CharT, _Traits, _Allocator>&
2529
+ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_string& __str,
2530
+ size_type __pos2, size_type __n)
2531
+ {
2532
+ size_type __str_sz = __str.size();
2533
+ if (__pos2 > __str_sz)
2534
+ this->__throw_out_of_range();
2535
+ return insert(__pos1, __str.data() + __pos2, _VSTD::min(__n, __str_sz - __pos2));
2536
+ }
2537
+
2538
+ template <class _CharT, class _Traits, class _Allocator>
2539
+ basic_string<_CharT, _Traits, _Allocator>&
2540
+ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer __s)
2541
+ {
2542
+ #ifdef _LIBCPP_DEBUG
2543
+ assert(__s != 0);
2544
+ #endif
2545
+ return insert(__pos, __s, traits_type::length(__s));
2546
+ }
2547
+
2548
+ template <class _CharT, class _Traits, class _Allocator>
2549
+ typename basic_string<_CharT, _Traits, _Allocator>::iterator
2550
+ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_type __c)
2551
+ {
2552
+ size_type __ip = static_cast<size_type>(__pos - begin());
2553
+ size_type __sz = size();
2554
+ size_type __cap = capacity();
2555
+ pointer __p;
2556
+ if (__cap == __sz)
2557
+ {
2558
+ __grow_by(__cap, 1, __sz, __ip, 0, 1);
2559
+ __p = __get_long_pointer();
2560
+ }
2561
+ else
2562
+ {
2563
+ __p = __get_pointer();
2564
+ size_type __n_move = __sz - __ip;
2565
+ if (__n_move != 0)
2566
+ traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
2567
+ }
2568
+ traits_type::assign(__p[__ip], __c);
2569
+ traits_type::assign(__p[++__sz], value_type());
2570
+ __set_size(__sz);
2571
+ return begin() + static_cast<difference_type>(__ip);
2572
+ }
2573
+
2574
+ template <class _CharT, class _Traits, class _Allocator>
2575
+ _LIBCPP_INLINE_VISIBILITY inline
2576
+ typename basic_string<_CharT, _Traits, _Allocator>::iterator
2577
+ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c)
2578
+ {
2579
+ difference_type __p = __pos - begin();
2580
+ insert(static_cast<size_type>(__p), __n, __c);
2581
+ return begin() + __p;
2582
+ }
2583
+
2584
+ // replace
2585
+
2586
+ template <class _CharT, class _Traits, class _Allocator>
2587
+ basic_string<_CharT, _Traits, _Allocator>&
2588
+ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2)
2589
+ {
2590
+ #ifdef _LIBCPP_DEBUG
2591
+ assert(__s != 0);
2592
+ #endif
2593
+ size_type __sz = size();
2594
+ if (__pos > __sz)
2595
+ this->__throw_out_of_range();
2596
+ __n1 = _VSTD::min(__n1, __sz - __pos);
2597
+ size_type __cap = capacity();
2598
+ if (__cap - __sz + __n1 >= __n2)
2599
+ {
2600
+ pointer __p = __get_pointer();
2601
+ if (__n1 != __n2)
2602
+ {
2603
+ size_type __n_move = __sz - __pos - __n1;
2604
+ if (__n_move != 0)
2605
+ {
2606
+ if (__n1 > __n2)
2607
+ {
2608
+ traits_type::move(__p + __pos, __s, __n2);
2609
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2610
+ goto __finish;
2611
+ }
2612
+ if (__p + __pos < __s && __s < __p + __sz)
2613
+ {
2614
+ if (__p + __pos + __n1 <= __s)
2615
+ __s += __n2 - __n1;
2616
+ else // __p + __pos < __s < __p + __pos + __n1
2617
+ {
2618
+ traits_type::move(__p + __pos, __s, __n1);
2619
+ __pos += __n1;
2620
+ __s += __n2;
2621
+ __n2 -= __n1;
2622
+ __n1 = 0;
2623
+ }
2624
+ }
2625
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2626
+ }
2627
+ }
2628
+ traits_type::move(__p + __pos, __s, __n2);
2629
+ __finish:
2630
+ __sz += __n2 - __n1;
2631
+ __set_size(__sz);
2632
+ __invalidate_iterators_past(__sz);
2633
+ traits_type::assign(__p[__sz], value_type());
2634
+ }
2635
+ else
2636
+ __grow_by_and_replace(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2, __s);
2637
+ return *this;
2638
+ }
2639
+
2640
+ template <class _CharT, class _Traits, class _Allocator>
2641
+ basic_string<_CharT, _Traits, _Allocator>&
2642
+ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
2643
+ {
2644
+ size_type __sz = size();
2645
+ if (__pos > __sz)
2646
+ this->__throw_out_of_range();
2647
+ __n1 = _VSTD::min(__n1, __sz - __pos);
2648
+ size_type __cap = capacity();
2649
+ pointer __p;
2650
+ if (__cap - __sz + __n1 >= __n2)
2651
+ {
2652
+ __p = __get_pointer();
2653
+ if (__n1 != __n2)
2654
+ {
2655
+ size_type __n_move = __sz - __pos - __n1;
2656
+ if (__n_move != 0)
2657
+ traits_type::move(__p + __pos + __n2, __p + __pos + __n1, __n_move);
2658
+ }
2659
+ }
2660
+ else
2661
+ {
2662
+ __grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
2663
+ __p = __get_long_pointer();
2664
+ }
2665
+ traits_type::assign(__p + __pos, __n2, __c);
2666
+ __sz += __n2 - __n1;
2667
+ __set_size(__sz);
2668
+ __invalidate_iterators_past(__sz);
2669
+ traits_type::assign(__p[__sz], value_type());
2670
+ return *this;
2671
+ }
2672
+
2673
+ template <class _CharT, class _Traits, class _Allocator>
2674
+ template<class _InputIterator>
2675
+ typename enable_if
2676
+ <
2677
+ __is_input_iterator<_InputIterator>::value,
2678
+ basic_string<_CharT, _Traits, _Allocator>&
2679
+ >::type
2680
+ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
2681
+ _InputIterator __j1, _InputIterator __j2)
2682
+ {
2683
+ for (; true; ++__i1, ++__j1)
2684
+ {
2685
+ if (__i1 == __i2)
2686
+ {
2687
+ if (__j1 != __j2)
2688
+ insert(__i1, __j1, __j2);
2689
+ break;
2690
+ }
2691
+ if (__j1 == __j2)
2692
+ {
2693
+ erase(__i1, __i2);
2694
+ break;
2695
+ }
2696
+ traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
2697
+ }
2698
+ return *this;
2699
+ }
2700
+
2701
+ template <class _CharT, class _Traits, class _Allocator>
2702
+ _LIBCPP_INLINE_VISIBILITY inline
2703
+ basic_string<_CharT, _Traits, _Allocator>&
2704
+ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str)
2705
+ {
2706
+ return replace(__pos1, __n1, __str.data(), __str.size());
2707
+ }
2708
+
2709
+ template <class _CharT, class _Traits, class _Allocator>
2710
+ basic_string<_CharT, _Traits, _Allocator>&
2711
+ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const basic_string& __str,
2712
+ size_type __pos2, size_type __n2)
2713
+ {
2714
+ size_type __str_sz = __str.size();
2715
+ if (__pos2 > __str_sz)
2716
+ this->__throw_out_of_range();
2717
+ return replace(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2, __str_sz - __pos2));
2718
+ }
2719
+
2720
+ template <class _CharT, class _Traits, class _Allocator>
2721
+ basic_string<_CharT, _Traits, _Allocator>&
2722
+ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const_pointer __s)
2723
+ {
2724
+ #ifdef _LIBCPP_DEBUG
2725
+ assert(__s != 0);
2726
+ #endif
2727
+ return replace(__pos, __n1, __s, traits_type::length(__s));
2728
+ }
2729
+
2730
+ template <class _CharT, class _Traits, class _Allocator>
2731
+ _LIBCPP_INLINE_VISIBILITY inline
2732
+ basic_string<_CharT, _Traits, _Allocator>&
2733
+ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
2734
+ {
2735
+ return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
2736
+ __str.data(), __str.size());
2737
+ }
2738
+
2739
+ template <class _CharT, class _Traits, class _Allocator>
2740
+ _LIBCPP_INLINE_VISIBILITY inline
2741
+ basic_string<_CharT, _Traits, _Allocator>&
2742
+ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n)
2743
+ {
2744
+ return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
2745
+ }
2746
+
2747
+ template <class _CharT, class _Traits, class _Allocator>
2748
+ _LIBCPP_INLINE_VISIBILITY inline
2749
+ basic_string<_CharT, _Traits, _Allocator>&
2750
+ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s)
2751
+ {
2752
+ return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
2753
+ }
2754
+
2755
+ template <class _CharT, class _Traits, class _Allocator>
2756
+ _LIBCPP_INLINE_VISIBILITY inline
2757
+ basic_string<_CharT, _Traits, _Allocator>&
2758
+ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
2759
+ {
2760
+ return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
2761
+ }
2762
+
2763
+ // erase
2764
+
2765
+ template <class _CharT, class _Traits, class _Allocator>
2766
+ basic_string<_CharT, _Traits, _Allocator>&
2767
+ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)
2768
+ {
2769
+ size_type __sz = size();
2770
+ if (__pos > __sz)
2771
+ this->__throw_out_of_range();
2772
+ if (__n)
2773
+ {
2774
+ pointer __p = __get_pointer();
2775
+ __n = _VSTD::min(__n, __sz - __pos);
2776
+ size_type __n_move = __sz - __pos - __n;
2777
+ if (__n_move != 0)
2778
+ traits_type::move(__p + __pos, __p + __pos + __n, __n_move);
2779
+ __sz -= __n;
2780
+ __set_size(__sz);
2781
+ __invalidate_iterators_past(__sz);
2782
+ traits_type::assign(__p[__sz], value_type());
2783
+ }
2784
+ return *this;
2785
+ }
2786
+
2787
+ template <class _CharT, class _Traits, class _Allocator>
2788
+ _LIBCPP_INLINE_VISIBILITY inline
2789
+ typename basic_string<_CharT, _Traits, _Allocator>::iterator
2790
+ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
2791
+ {
2792
+ iterator __b = begin();
2793
+ size_type __r = static_cast<size_type>(__pos - __b);
2794
+ erase(__r, 1);
2795
+ return __b + static_cast<difference_type>(__r);
2796
+ }
2797
+
2798
+ template <class _CharT, class _Traits, class _Allocator>
2799
+ _LIBCPP_INLINE_VISIBILITY inline
2800
+ typename basic_string<_CharT, _Traits, _Allocator>::iterator
2801
+ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
2802
+ {
2803
+ iterator __b = begin();
2804
+ size_type __r = static_cast<size_type>(__first - __b);
2805
+ erase(__r, static_cast<size_type>(__last - __first));
2806
+ return __b + static_cast<difference_type>(__r);
2807
+ }
2808
+
2809
+ template <class _CharT, class _Traits, class _Allocator>
2810
+ _LIBCPP_INLINE_VISIBILITY inline
2811
+ void
2812
+ basic_string<_CharT, _Traits, _Allocator>::pop_back()
2813
+ {
2814
+ #ifdef _LIBCPP_DEBUG
2815
+ assert(!empty());
2816
+ #endif
2817
+ size_type __sz;
2818
+ if (__is_long())
2819
+ {
2820
+ __sz = __get_long_size() - 1;
2821
+ __set_long_size(__sz);
2822
+ traits_type::assign(*(__get_long_pointer() + __sz), value_type());
2823
+ }
2824
+ else
2825
+ {
2826
+ __sz = __get_short_size() - 1;
2827
+ __set_short_size(__sz);
2828
+ traits_type::assign(*(__get_short_pointer() + __sz), value_type());
2829
+ }
2830
+ __invalidate_iterators_past(__sz);
2831
+ }
2832
+
2833
+ template <class _CharT, class _Traits, class _Allocator>
2834
+ _LIBCPP_INLINE_VISIBILITY inline
2835
+ void
2836
+ basic_string<_CharT, _Traits, _Allocator>::clear() _NOEXCEPT
2837
+ {
2838
+ __invalidate_all_iterators();
2839
+ if (__is_long())
2840
+ {
2841
+ traits_type::assign(*__get_long_pointer(), value_type());
2842
+ __set_long_size(0);
2843
+ }
2844
+ else
2845
+ {
2846
+ traits_type::assign(*__get_short_pointer(), value_type());
2847
+ __set_short_size(0);
2848
+ }
2849
+ }
2850
+
2851
+ template <class _CharT, class _Traits, class _Allocator>
2852
+ _LIBCPP_INLINE_VISIBILITY inline
2853
+ void
2854
+ basic_string<_CharT, _Traits, _Allocator>::__erase_to_end(size_type __pos)
2855
+ {
2856
+ if (__is_long())
2857
+ {
2858
+ traits_type::assign(*(__get_long_pointer() + __pos), value_type());
2859
+ __set_long_size(__pos);
2860
+ }
2861
+ else
2862
+ {
2863
+ traits_type::assign(*(__get_short_pointer() + __pos), value_type());
2864
+ __set_short_size(__pos);
2865
+ }
2866
+ __invalidate_iterators_past(__pos);
2867
+ }
2868
+
2869
+ template <class _CharT, class _Traits, class _Allocator>
2870
+ void
2871
+ basic_string<_CharT, _Traits, _Allocator>::resize(size_type __n, value_type __c)
2872
+ {
2873
+ size_type __sz = size();
2874
+ if (__n > __sz)
2875
+ append(__n - __sz, __c);
2876
+ else
2877
+ __erase_to_end(__n);
2878
+ }
2879
+
2880
+ template <class _CharT, class _Traits, class _Allocator>
2881
+ _LIBCPP_INLINE_VISIBILITY inline
2882
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
2883
+ basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
2884
+ {
2885
+ size_type __m = __alloc_traits::max_size(__alloc());
2886
+ #if _LIBCPP_BIG_ENDIAN
2887
+ return (__m <= ~__long_mask ? __m : __m/2) - 1;
2888
+ #else
2889
+ return __m - 1;
2890
+ #endif
2891
+ }
2892
+
2893
+ template <class _CharT, class _Traits, class _Allocator>
2894
+ void
2895
+ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
2896
+ {
2897
+ if (__res_arg > max_size())
2898
+ this->__throw_length_error();
2899
+ size_type __cap = capacity();
2900
+ size_type __sz = size();
2901
+ __res_arg = _VSTD::max(__res_arg, __sz);
2902
+ __res_arg = __recommend(__res_arg);
2903
+ if (__res_arg != __cap)
2904
+ {
2905
+ pointer __new_data, __p;
2906
+ bool __was_long, __now_long;
2907
+ if (__res_arg == __min_cap - 1)
2908
+ {
2909
+ __was_long = true;
2910
+ __now_long = false;
2911
+ __new_data = __get_short_pointer();
2912
+ __p = __get_long_pointer();
2913
+ }
2914
+ else
2915
+ {
2916
+ if (__res_arg > __cap)
2917
+ __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
2918
+ else
2919
+ {
2920
+ #ifndef _LIBCPP_NO_EXCEPTIONS
2921
+ try
2922
+ {
2923
+ #endif // _LIBCPP_NO_EXCEPTIONS
2924
+ __new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
2925
+ #ifndef _LIBCPP_NO_EXCEPTIONS
2926
+ }
2927
+ catch (...)
2928
+ {
2929
+ return;
2930
+ }
2931
+ #else // _LIBCPP_NO_EXCEPTIONS
2932
+ if (__new_data == 0)
2933
+ return;
2934
+ #endif // _LIBCPP_NO_EXCEPTIONS
2935
+ }
2936
+ __now_long = true;
2937
+ __was_long = __is_long();
2938
+ __p = __get_pointer();
2939
+ }
2940
+ traits_type::copy(__new_data, __p, size()+1);
2941
+ if (__was_long)
2942
+ __alloc_traits::deallocate(__alloc(), __p, __cap+1);
2943
+ if (__now_long)
2944
+ {
2945
+ __set_long_cap(__res_arg+1);
2946
+ __set_long_size(__sz);
2947
+ __set_long_pointer(__new_data);
2948
+ }
2949
+ else
2950
+ __set_short_size(__sz);
2951
+ __invalidate_all_iterators();
2952
+ }
2953
+ }
2954
+
2955
+ template <class _CharT, class _Traits, class _Allocator>
2956
+ _LIBCPP_INLINE_VISIBILITY inline
2957
+ typename basic_string<_CharT, _Traits, _Allocator>::const_reference
2958
+ basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos) const
2959
+ {
2960
+ #ifdef __LIBCPP_DEBUG
2961
+ assert(__pos <= size());
2962
+ #endif
2963
+ return *(data() + __pos);
2964
+ }
2965
+
2966
+ template <class _CharT, class _Traits, class _Allocator>
2967
+ _LIBCPP_INLINE_VISIBILITY inline
2968
+ typename basic_string<_CharT, _Traits, _Allocator>::reference
2969
+ basic_string<_CharT, _Traits, _Allocator>::operator[](size_type __pos)
2970
+ {
2971
+ #ifdef __LIBCPP_DEBUG
2972
+ assert(__pos < size());
2973
+ #endif
2974
+ return *(__get_pointer() + __pos);
2975
+ }
2976
+
2977
+ template <class _CharT, class _Traits, class _Allocator>
2978
+ typename basic_string<_CharT, _Traits, _Allocator>::const_reference
2979
+ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const
2980
+ {
2981
+ if (__n >= size())
2982
+ this->__throw_out_of_range();
2983
+ return (*this)[__n];
2984
+ }
2985
+
2986
+ template <class _CharT, class _Traits, class _Allocator>
2987
+ typename basic_string<_CharT, _Traits, _Allocator>::reference
2988
+ basic_string<_CharT, _Traits, _Allocator>::at(size_type __n)
2989
+ {
2990
+ if (__n >= size())
2991
+ this->__throw_out_of_range();
2992
+ return (*this)[__n];
2993
+ }
2994
+
2995
+ template <class _CharT, class _Traits, class _Allocator>
2996
+ _LIBCPP_INLINE_VISIBILITY inline
2997
+ typename basic_string<_CharT, _Traits, _Allocator>::reference
2998
+ basic_string<_CharT, _Traits, _Allocator>::front()
2999
+ {
3000
+ #ifdef _LIBCPP_DEBUG
3001
+ assert(!empty());
3002
+ #endif
3003
+ return *__get_pointer();
3004
+ }
3005
+
3006
+ template <class _CharT, class _Traits, class _Allocator>
3007
+ _LIBCPP_INLINE_VISIBILITY inline
3008
+ typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3009
+ basic_string<_CharT, _Traits, _Allocator>::front() const
3010
+ {
3011
+ #ifdef _LIBCPP_DEBUG
3012
+ assert(!empty());
3013
+ #endif
3014
+ return *data();
3015
+ }
3016
+
3017
+ template <class _CharT, class _Traits, class _Allocator>
3018
+ _LIBCPP_INLINE_VISIBILITY inline
3019
+ typename basic_string<_CharT, _Traits, _Allocator>::reference
3020
+ basic_string<_CharT, _Traits, _Allocator>::back()
3021
+ {
3022
+ #ifdef _LIBCPP_DEBUG
3023
+ assert(!empty());
3024
+ #endif
3025
+ return *(__get_pointer() + size() - 1);
3026
+ }
3027
+
3028
+ template <class _CharT, class _Traits, class _Allocator>
3029
+ _LIBCPP_INLINE_VISIBILITY inline
3030
+ typename basic_string<_CharT, _Traits, _Allocator>::const_reference
3031
+ basic_string<_CharT, _Traits, _Allocator>::back() const
3032
+ {
3033
+ #ifdef _LIBCPP_DEBUG
3034
+ assert(!empty());
3035
+ #endif
3036
+ return *(data() + size() - 1);
3037
+ }
3038
+
3039
+ template <class _CharT, class _Traits, class _Allocator>
3040
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3041
+ basic_string<_CharT, _Traits, _Allocator>::copy(pointer __s, size_type __n, size_type __pos) const
3042
+ {
3043
+ size_type __sz = size();
3044
+ if (__pos > __sz)
3045
+ this->__throw_out_of_range();
3046
+ size_type __rlen = _VSTD::min(__n, __sz - __pos);
3047
+ traits_type::copy(__s, data() + __pos, __rlen);
3048
+ return __rlen;
3049
+ }
3050
+
3051
+ template <class _CharT, class _Traits, class _Allocator>
3052
+ _LIBCPP_INLINE_VISIBILITY inline
3053
+ basic_string<_CharT, _Traits, _Allocator>
3054
+ basic_string<_CharT, _Traits, _Allocator>::substr(size_type __pos, size_type __n) const
3055
+ {
3056
+ return basic_string(*this, __pos, __n, __alloc());
3057
+ }
3058
+
3059
+ template <class _CharT, class _Traits, class _Allocator>
3060
+ _LIBCPP_INLINE_VISIBILITY inline
3061
+ void
3062
+ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
3063
+ _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
3064
+ __is_nothrow_swappable<allocator_type>::value)
3065
+ {
3066
+ _VSTD::swap(__r_.first(), __str.__r_.first());
3067
+ __swap_alloc(__alloc(), __str.__alloc());
3068
+ #ifdef _LIBCPP_DEBUG
3069
+ __invalidate_all_iterators();
3070
+ __str.__invalidate_all_iterators();
3071
+ #endif // _LIBCPP_DEBUG
3072
+ }
3073
+
3074
+ // find
3075
+
3076
+ template <class _Traits>
3077
+ struct _LIBCPP_HIDDEN __traits_eq
3078
+ {
3079
+ typedef typename _Traits::char_type char_type;
3080
+ _LIBCPP_INLINE_VISIBILITY
3081
+ bool operator()(const char_type& __x, const char_type& __y) _NOEXCEPT
3082
+ {return _Traits::eq(__x, __y);}
3083
+ };
3084
+
3085
+ template<class _CharT, class _Traits, class _Allocator>
3086
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3087
+ basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s,
3088
+ size_type __pos,
3089
+ size_type __n) const _NOEXCEPT
3090
+ {
3091
+ #ifdef _LIBCPP_DEBUG
3092
+ assert(__s != 0);
3093
+ #endif
3094
+ size_type __sz = size();
3095
+ if (__pos > __sz || __sz - __pos < __n)
3096
+ return npos;
3097
+ if (__n == 0)
3098
+ return __pos;
3099
+ const_pointer __p = data();
3100
+ const_pointer __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n,
3101
+ __traits_eq<traits_type>());
3102
+ if (__r == __p + __sz)
3103
+ return npos;
3104
+ return static_cast<size_type>(__r - __p);
3105
+ }
3106
+
3107
+ template<class _CharT, class _Traits, class _Allocator>
3108
+ _LIBCPP_INLINE_VISIBILITY inline
3109
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3110
+ basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
3111
+ size_type __pos) const _NOEXCEPT
3112
+ {
3113
+ return find(__str.data(), __pos, __str.size());
3114
+ }
3115
+
3116
+ template<class _CharT, class _Traits, class _Allocator>
3117
+ _LIBCPP_INLINE_VISIBILITY inline
3118
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3119
+ basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s,
3120
+ size_type __pos) const _NOEXCEPT
3121
+ {
3122
+ #ifdef _LIBCPP_DEBUG
3123
+ assert(__s != 0);
3124
+ #endif
3125
+ return find(__s, __pos, traits_type::length(__s));
3126
+ }
3127
+
3128
+ template<class _CharT, class _Traits, class _Allocator>
3129
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3130
+ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
3131
+ size_type __pos) const _NOEXCEPT
3132
+ {
3133
+ size_type __sz = size();
3134
+ if (__pos >= __sz)
3135
+ return npos;
3136
+ const_pointer __p = data();
3137
+ const_pointer __r = traits_type::find(__p + __pos, __sz - __pos, __c);
3138
+ if (__r == 0)
3139
+ return npos;
3140
+ return static_cast<size_type>(__r - __p);
3141
+ }
3142
+
3143
+ // rfind
3144
+
3145
+ template<class _CharT, class _Traits, class _Allocator>
3146
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3147
+ basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s,
3148
+ size_type __pos,
3149
+ size_type __n) const _NOEXCEPT
3150
+ {
3151
+ #ifdef _LIBCPP_DEBUG
3152
+ assert(__s != 0);
3153
+ #endif
3154
+ size_type __sz = size();
3155
+ __pos = _VSTD::min(__pos, __sz);
3156
+ if (__n < __sz - __pos)
3157
+ __pos += __n;
3158
+ else
3159
+ __pos = __sz;
3160
+ const_pointer __p = data();
3161
+ const_pointer __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n,
3162
+ __traits_eq<traits_type>());
3163
+ if (__n > 0 && __r == __p + __pos)
3164
+ return npos;
3165
+ return static_cast<size_type>(__r - __p);
3166
+ }
3167
+
3168
+ template<class _CharT, class _Traits, class _Allocator>
3169
+ _LIBCPP_INLINE_VISIBILITY inline
3170
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3171
+ basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
3172
+ size_type __pos) const _NOEXCEPT
3173
+ {
3174
+ return rfind(__str.data(), __pos, __str.size());
3175
+ }
3176
+
3177
+ template<class _CharT, class _Traits, class _Allocator>
3178
+ _LIBCPP_INLINE_VISIBILITY inline
3179
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3180
+ basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s,
3181
+ size_type __pos) const _NOEXCEPT
3182
+ {
3183
+ #ifdef _LIBCPP_DEBUG
3184
+ assert(__s != 0);
3185
+ #endif
3186
+ return rfind(__s, __pos, traits_type::length(__s));
3187
+ }
3188
+
3189
+ template<class _CharT, class _Traits, class _Allocator>
3190
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3191
+ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
3192
+ size_type __pos) const _NOEXCEPT
3193
+ {
3194
+ size_type __sz = size();
3195
+ if (__sz)
3196
+ {
3197
+ if (__pos < __sz)
3198
+ ++__pos;
3199
+ else
3200
+ __pos = __sz;
3201
+ const_pointer __p = data();
3202
+ for (const_pointer __ps = __p + __pos; __ps != __p;)
3203
+ {
3204
+ if (traits_type::eq(*--__ps, __c))
3205
+ return static_cast<size_type>(__ps - __p);
3206
+ }
3207
+ }
3208
+ return npos;
3209
+ }
3210
+
3211
+ // find_first_of
3212
+
3213
+ template<class _CharT, class _Traits, class _Allocator>
3214
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3215
+ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s,
3216
+ size_type __pos,
3217
+ size_type __n) const _NOEXCEPT
3218
+ {
3219
+ #ifdef _LIBCPP_DEBUG
3220
+ assert(__s != 0);
3221
+ #endif
3222
+ size_type __sz = size();
3223
+ if (__pos >= __sz || __n == 0)
3224
+ return npos;
3225
+ const_pointer __p = data();
3226
+ const_pointer __r = _VSTD::find_first_of(__p + __pos, __p + __sz, __s,
3227
+ __s + __n, __traits_eq<traits_type>());
3228
+ if (__r == __p + __sz)
3229
+ return npos;
3230
+ return static_cast<size_type>(__r - __p);
3231
+ }
3232
+
3233
+ template<class _CharT, class _Traits, class _Allocator>
3234
+ _LIBCPP_INLINE_VISIBILITY inline
3235
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3236
+ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __str,
3237
+ size_type __pos) const _NOEXCEPT
3238
+ {
3239
+ return find_first_of(__str.data(), __pos, __str.size());
3240
+ }
3241
+
3242
+ template<class _CharT, class _Traits, class _Allocator>
3243
+ _LIBCPP_INLINE_VISIBILITY inline
3244
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3245
+ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s,
3246
+ size_type __pos) const _NOEXCEPT
3247
+ {
3248
+ #ifdef _LIBCPP_DEBUG
3249
+ assert(__s != 0);
3250
+ #endif
3251
+ return find_first_of(__s, __pos, traits_type::length(__s));
3252
+ }
3253
+
3254
+ template<class _CharT, class _Traits, class _Allocator>
3255
+ _LIBCPP_INLINE_VISIBILITY inline
3256
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3257
+ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
3258
+ size_type __pos) const _NOEXCEPT
3259
+ {
3260
+ return find(__c, __pos);
3261
+ }
3262
+
3263
+ // find_last_of
3264
+
3265
+ template<class _CharT, class _Traits, class _Allocator>
3266
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3267
+ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s,
3268
+ size_type __pos,
3269
+ size_type __n) const _NOEXCEPT
3270
+ {
3271
+ #ifdef _LIBCPP_DEBUG
3272
+ assert(__s != 0);
3273
+ #endif
3274
+ if (__n != 0)
3275
+ {
3276
+ size_type __sz = size();
3277
+ if (__pos < __sz)
3278
+ ++__pos;
3279
+ else
3280
+ __pos = __sz;
3281
+ const_pointer __p = data();
3282
+ for (const_pointer __ps = __p + __pos; __ps != __p;)
3283
+ {
3284
+ const_pointer __r = traits_type::find(__s, __n, *--__ps);
3285
+ if (__r)
3286
+ return static_cast<size_type>(__ps - __p);
3287
+ }
3288
+ }
3289
+ return npos;
3290
+ }
3291
+
3292
+ template<class _CharT, class _Traits, class _Allocator>
3293
+ _LIBCPP_INLINE_VISIBILITY inline
3294
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3295
+ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __str,
3296
+ size_type __pos) const _NOEXCEPT
3297
+ {
3298
+ return find_last_of(__str.data(), __pos, __str.size());
3299
+ }
3300
+
3301
+ template<class _CharT, class _Traits, class _Allocator>
3302
+ _LIBCPP_INLINE_VISIBILITY inline
3303
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3304
+ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s,
3305
+ size_type __pos) const _NOEXCEPT
3306
+ {
3307
+ #ifdef _LIBCPP_DEBUG
3308
+ assert(__s != 0);
3309
+ #endif
3310
+ return find_last_of(__s, __pos, traits_type::length(__s));
3311
+ }
3312
+
3313
+ template<class _CharT, class _Traits, class _Allocator>
3314
+ _LIBCPP_INLINE_VISIBILITY inline
3315
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3316
+ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
3317
+ size_type __pos) const _NOEXCEPT
3318
+ {
3319
+ return rfind(__c, __pos);
3320
+ }
3321
+
3322
+ // find_first_not_of
3323
+
3324
+ template<class _CharT, class _Traits, class _Allocator>
3325
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3326
+ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s,
3327
+ size_type __pos,
3328
+ size_type __n) const _NOEXCEPT
3329
+ {
3330
+ #ifdef _LIBCPP_DEBUG
3331
+ assert(__s != 0);
3332
+ #endif
3333
+ size_type __sz = size();
3334
+ if (__pos < __sz)
3335
+ {
3336
+ const_pointer __p = data();
3337
+ const_pointer __pe = __p + __sz;
3338
+ for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps)
3339
+ if (traits_type::find(__s, __n, *__ps) == 0)
3340
+ return static_cast<size_type>(__ps - __p);
3341
+ }
3342
+ return npos;
3343
+ }
3344
+
3345
+ template<class _CharT, class _Traits, class _Allocator>
3346
+ _LIBCPP_INLINE_VISIBILITY inline
3347
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3348
+ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string& __str,
3349
+ size_type __pos) const _NOEXCEPT
3350
+ {
3351
+ return find_first_not_of(__str.data(), __pos, __str.size());
3352
+ }
3353
+
3354
+ template<class _CharT, class _Traits, class _Allocator>
3355
+ _LIBCPP_INLINE_VISIBILITY inline
3356
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3357
+ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s,
3358
+ size_type __pos) const _NOEXCEPT
3359
+ {
3360
+ #ifdef _LIBCPP_DEBUG
3361
+ assert(__s != 0);
3362
+ #endif
3363
+ return find_first_not_of(__s, __pos, traits_type::length(__s));
3364
+ }
3365
+
3366
+ template<class _CharT, class _Traits, class _Allocator>
3367
+ _LIBCPP_INLINE_VISIBILITY inline
3368
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3369
+ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
3370
+ size_type __pos) const _NOEXCEPT
3371
+ {
3372
+ size_type __sz = size();
3373
+ if (__pos < __sz)
3374
+ {
3375
+ const_pointer __p = data();
3376
+ const_pointer __pe = __p + __sz;
3377
+ for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps)
3378
+ if (!traits_type::eq(*__ps, __c))
3379
+ return static_cast<size_type>(__ps - __p);
3380
+ }
3381
+ return npos;
3382
+ }
3383
+
3384
+ // find_last_not_of
3385
+
3386
+ template<class _CharT, class _Traits, class _Allocator>
3387
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3388
+ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s,
3389
+ size_type __pos,
3390
+ size_type __n) const _NOEXCEPT
3391
+ {
3392
+ #ifdef _LIBCPP_DEBUG
3393
+ assert(__s != 0);
3394
+ #endif
3395
+ size_type __sz = size();
3396
+ if (__pos < __sz)
3397
+ ++__pos;
3398
+ else
3399
+ __pos = __sz;
3400
+ const_pointer __p = data();
3401
+ for (const_pointer __ps = __p + __pos; __ps != __p;)
3402
+ if (traits_type::find(__s, __n, *--__ps) == 0)
3403
+ return static_cast<size_type>(__ps - __p);
3404
+ return npos;
3405
+ }
3406
+
3407
+ template<class _CharT, class _Traits, class _Allocator>
3408
+ _LIBCPP_INLINE_VISIBILITY inline
3409
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3410
+ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string& __str,
3411
+ size_type __pos) const _NOEXCEPT
3412
+ {
3413
+ return find_last_not_of(__str.data(), __pos, __str.size());
3414
+ }
3415
+
3416
+ template<class _CharT, class _Traits, class _Allocator>
3417
+ _LIBCPP_INLINE_VISIBILITY inline
3418
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3419
+ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s,
3420
+ size_type __pos) const _NOEXCEPT
3421
+ {
3422
+ #ifdef _LIBCPP_DEBUG
3423
+ assert(__s != 0);
3424
+ #endif
3425
+ return find_last_not_of(__s, __pos, traits_type::length(__s));
3426
+ }
3427
+
3428
+ template<class _CharT, class _Traits, class _Allocator>
3429
+ _LIBCPP_INLINE_VISIBILITY inline
3430
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type
3431
+ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
3432
+ size_type __pos) const _NOEXCEPT
3433
+ {
3434
+ size_type __sz = size();
3435
+ if (__pos < __sz)
3436
+ ++__pos;
3437
+ else
3438
+ __pos = __sz;
3439
+ const_pointer __p = data();
3440
+ for (const_pointer __ps = __p + __pos; __ps != __p;)
3441
+ if (!traits_type::eq(*--__ps, __c))
3442
+ return static_cast<size_type>(__ps - __p);
3443
+ return npos;
3444
+ }
3445
+
3446
+ // compare
3447
+
3448
+ template <class _CharT, class _Traits, class _Allocator>
3449
+ _LIBCPP_INLINE_VISIBILITY inline
3450
+ int
3451
+ basic_string<_CharT, _Traits, _Allocator>::compare(const basic_string& __str) const _NOEXCEPT
3452
+ {
3453
+ size_t __lhs_sz = size();
3454
+ size_t __rhs_sz = __str.size();
3455
+ int __result = traits_type::compare(data(), __str.data(),
3456
+ _VSTD::min(__lhs_sz, __rhs_sz));
3457
+ if (__result != 0)
3458
+ return __result;
3459
+ if (__lhs_sz < __rhs_sz)
3460
+ return -1;
3461
+ if (__lhs_sz > __rhs_sz)
3462
+ return 1;
3463
+ return 0;
3464
+ }
3465
+
3466
+ template <class _CharT, class _Traits, class _Allocator>
3467
+ _LIBCPP_INLINE_VISIBILITY inline
3468
+ int
3469
+ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3470
+ size_type __n1,
3471
+ const basic_string& __str) const
3472
+ {
3473
+ return compare(__pos1, __n1, __str.data(), __str.size());
3474
+ }
3475
+
3476
+ template <class _CharT, class _Traits, class _Allocator>
3477
+ int
3478
+ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3479
+ size_type __n1,
3480
+ const basic_string& __str,
3481
+ size_type __pos2,
3482
+ size_type __n2) const
3483
+ {
3484
+ size_type __sz = __str.size();
3485
+ if (__pos2 > __sz)
3486
+ this->__throw_out_of_range();
3487
+ return compare(__pos1, __n1, __str.data() + __pos2, _VSTD::min(__n2,
3488
+ __sz - __pos2));
3489
+ }
3490
+
3491
+ template <class _CharT, class _Traits, class _Allocator>
3492
+ int
3493
+ basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT
3494
+ {
3495
+ #ifdef _LIBCPP_DEBUG
3496
+ assert(__s != 0);
3497
+ #endif
3498
+ return compare(0, npos, __s, traits_type::length(__s));
3499
+ }
3500
+
3501
+ template <class _CharT, class _Traits, class _Allocator>
3502
+ int
3503
+ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3504
+ size_type __n1,
3505
+ const_pointer __s) const
3506
+ {
3507
+ #ifdef _LIBCPP_DEBUG
3508
+ assert(__s != 0);
3509
+ #endif
3510
+ return compare(__pos1, __n1, __s, traits_type::length(__s));
3511
+ }
3512
+
3513
+ template <class _CharT, class _Traits, class _Allocator>
3514
+ int
3515
+ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
3516
+ size_type __n1,
3517
+ const_pointer __s,
3518
+ size_type __n2) const
3519
+ {
3520
+ #ifdef _LIBCPP_DEBUG
3521
+ assert(__s != 0);
3522
+ #endif
3523
+ size_type __sz = size();
3524
+ if (__pos1 > __sz || __n2 == npos)
3525
+ this->__throw_out_of_range();
3526
+ size_type __rlen = _VSTD::min(__n1, __sz - __pos1);
3527
+ int __r = traits_type::compare(data() + __pos1, __s, _VSTD::min(__rlen, __n2));
3528
+ if (__r == 0)
3529
+ {
3530
+ if (__rlen < __n2)
3531
+ __r = -1;
3532
+ else if (__rlen > __n2)
3533
+ __r = 1;
3534
+ }
3535
+ return __r;
3536
+ }
3537
+
3538
+ // __invariants
3539
+
3540
+ template<class _CharT, class _Traits, class _Allocator>
3541
+ _LIBCPP_INLINE_VISIBILITY inline
3542
+ bool
3543
+ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
3544
+ {
3545
+ if (size() > capacity())
3546
+ return false;
3547
+ if (capacity() < __min_cap - 1)
3548
+ return false;
3549
+ if (data() == 0)
3550
+ return false;
3551
+ if (data()[size()] != value_type(0))
3552
+ return false;
3553
+ return true;
3554
+ }
3555
+
3556
+ // operator==
3557
+
3558
+ template<class _CharT, class _Traits, class _Allocator>
3559
+ _LIBCPP_INLINE_VISIBILITY inline
3560
+ bool
3561
+ operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3562
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3563
+ {
3564
+ return __lhs.size() == __rhs.size() && _Traits::compare(__lhs.data(),
3565
+ __rhs.data(),
3566
+ __lhs.size()) == 0;
3567
+ }
3568
+
3569
+ template<class _CharT, class _Traits, class _Allocator>
3570
+ _LIBCPP_INLINE_VISIBILITY inline
3571
+ bool
3572
+ operator==(const _CharT* __lhs,
3573
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3574
+ {
3575
+ return __rhs.compare(__lhs) == 0;
3576
+ }
3577
+
3578
+ template<class _CharT, class _Traits, class _Allocator>
3579
+ _LIBCPP_INLINE_VISIBILITY inline
3580
+ bool
3581
+ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
3582
+ const _CharT* __rhs) _NOEXCEPT
3583
+ {
3584
+ return __lhs.compare(__rhs) == 0;
3585
+ }
3586
+
3587
+ // operator!=
3588
+
3589
+ template<class _CharT, class _Traits, class _Allocator>
3590
+ _LIBCPP_INLINE_VISIBILITY inline
3591
+ bool
3592
+ operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
3593
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3594
+ {
3595
+ return !(__lhs == __rhs);
3596
+ }
3597
+
3598
+ template<class _CharT, class _Traits, class _Allocator>
3599
+ _LIBCPP_INLINE_VISIBILITY inline
3600
+ bool
3601
+ operator!=(const _CharT* __lhs,
3602
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3603
+ {
3604
+ return !(__lhs == __rhs);
3605
+ }
3606
+
3607
+ template<class _CharT, class _Traits, class _Allocator>
3608
+ _LIBCPP_INLINE_VISIBILITY inline
3609
+ bool
3610
+ operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3611
+ const _CharT* __rhs) _NOEXCEPT
3612
+ {
3613
+ return !(__lhs == __rhs);
3614
+ }
3615
+
3616
+ // operator<
3617
+
3618
+ template<class _CharT, class _Traits, class _Allocator>
3619
+ _LIBCPP_INLINE_VISIBILITY inline
3620
+ bool
3621
+ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3622
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3623
+ {
3624
+ return __lhs.compare(__rhs) < 0;
3625
+ }
3626
+
3627
+ template<class _CharT, class _Traits, class _Allocator>
3628
+ _LIBCPP_INLINE_VISIBILITY inline
3629
+ bool
3630
+ operator< (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3631
+ const _CharT* __rhs) _NOEXCEPT
3632
+ {
3633
+ return __lhs.compare(__rhs) < 0;
3634
+ }
3635
+
3636
+ template<class _CharT, class _Traits, class _Allocator>
3637
+ _LIBCPP_INLINE_VISIBILITY inline
3638
+ bool
3639
+ operator< (const _CharT* __lhs,
3640
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3641
+ {
3642
+ return __rhs.compare(__lhs) > 0;
3643
+ }
3644
+
3645
+ // operator>
3646
+
3647
+ template<class _CharT, class _Traits, class _Allocator>
3648
+ _LIBCPP_INLINE_VISIBILITY inline
3649
+ bool
3650
+ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3651
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3652
+ {
3653
+ return __rhs < __lhs;
3654
+ }
3655
+
3656
+ template<class _CharT, class _Traits, class _Allocator>
3657
+ _LIBCPP_INLINE_VISIBILITY inline
3658
+ bool
3659
+ operator> (const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3660
+ const _CharT* __rhs) _NOEXCEPT
3661
+ {
3662
+ return __rhs < __lhs;
3663
+ }
3664
+
3665
+ template<class _CharT, class _Traits, class _Allocator>
3666
+ _LIBCPP_INLINE_VISIBILITY inline
3667
+ bool
3668
+ operator> (const _CharT* __lhs,
3669
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3670
+ {
3671
+ return __rhs < __lhs;
3672
+ }
3673
+
3674
+ // operator<=
3675
+
3676
+ template<class _CharT, class _Traits, class _Allocator>
3677
+ _LIBCPP_INLINE_VISIBILITY inline
3678
+ bool
3679
+ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3680
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3681
+ {
3682
+ return !(__rhs < __lhs);
3683
+ }
3684
+
3685
+ template<class _CharT, class _Traits, class _Allocator>
3686
+ _LIBCPP_INLINE_VISIBILITY inline
3687
+ bool
3688
+ operator<=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3689
+ const _CharT* __rhs) _NOEXCEPT
3690
+ {
3691
+ return !(__rhs < __lhs);
3692
+ }
3693
+
3694
+ template<class _CharT, class _Traits, class _Allocator>
3695
+ _LIBCPP_INLINE_VISIBILITY inline
3696
+ bool
3697
+ operator<=(const _CharT* __lhs,
3698
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3699
+ {
3700
+ return !(__rhs < __lhs);
3701
+ }
3702
+
3703
+ // operator>=
3704
+
3705
+ template<class _CharT, class _Traits, class _Allocator>
3706
+ _LIBCPP_INLINE_VISIBILITY inline
3707
+ bool
3708
+ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3709
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3710
+ {
3711
+ return !(__lhs < __rhs);
3712
+ }
3713
+
3714
+ template<class _CharT, class _Traits, class _Allocator>
3715
+ _LIBCPP_INLINE_VISIBILITY inline
3716
+ bool
3717
+ operator>=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3718
+ const _CharT* __rhs) _NOEXCEPT
3719
+ {
3720
+ return !(__lhs < __rhs);
3721
+ }
3722
+
3723
+ template<class _CharT, class _Traits, class _Allocator>
3724
+ _LIBCPP_INLINE_VISIBILITY inline
3725
+ bool
3726
+ operator>=(const _CharT* __lhs,
3727
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
3728
+ {
3729
+ return !(__lhs < __rhs);
3730
+ }
3731
+
3732
+ // operator +
3733
+
3734
+ template<class _CharT, class _Traits, class _Allocator>
3735
+ basic_string<_CharT, _Traits, _Allocator>
3736
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
3737
+ const basic_string<_CharT, _Traits, _Allocator>& __rhs)
3738
+ {
3739
+ basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator());
3740
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size();
3741
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size();
3742
+ __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz);
3743
+ __r.append(__rhs.data(), __rhs_sz);
3744
+ return __r;
3745
+ }
3746
+
3747
+ template<class _CharT, class _Traits, class _Allocator>
3748
+ basic_string<_CharT, _Traits, _Allocator>
3749
+ operator+(const _CharT* __lhs , const basic_string<_CharT,_Traits,_Allocator>& __rhs)
3750
+ {
3751
+ basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator());
3752
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = _Traits::length(__lhs);
3753
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size();
3754
+ __r.__init(__lhs, __lhs_sz, __lhs_sz + __rhs_sz);
3755
+ __r.append(__rhs.data(), __rhs_sz);
3756
+ return __r;
3757
+ }
3758
+
3759
+ template<class _CharT, class _Traits, class _Allocator>
3760
+ basic_string<_CharT, _Traits, _Allocator>
3761
+ operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Allocator>& __rhs)
3762
+ {
3763
+ basic_string<_CharT, _Traits, _Allocator> __r(__rhs.get_allocator());
3764
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = __rhs.size();
3765
+ __r.__init(&__lhs, 1, 1 + __rhs_sz);
3766
+ __r.append(__rhs.data(), __rhs_sz);
3767
+ return __r;
3768
+ }
3769
+
3770
+ template<class _CharT, class _Traits, class _Allocator>
3771
+ basic_string<_CharT, _Traits, _Allocator>
3772
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const _CharT* __rhs)
3773
+ {
3774
+ basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator());
3775
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size();
3776
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __rhs_sz = _Traits::length(__rhs);
3777
+ __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + __rhs_sz);
3778
+ __r.append(__rhs, __rhs_sz);
3779
+ return __r;
3780
+ }
3781
+
3782
+ template<class _CharT, class _Traits, class _Allocator>
3783
+ basic_string<_CharT, _Traits, _Allocator>
3784
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
3785
+ {
3786
+ basic_string<_CharT, _Traits, _Allocator> __r(__lhs.get_allocator());
3787
+ typename basic_string<_CharT, _Traits, _Allocator>::size_type __lhs_sz = __lhs.size();
3788
+ __r.__init(__lhs.data(), __lhs_sz, __lhs_sz + 1);
3789
+ __r.push_back(__rhs);
3790
+ return __r;
3791
+ }
3792
+
3793
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3794
+
3795
+ template<class _CharT, class _Traits, class _Allocator>
3796
+ _LIBCPP_INLINE_VISIBILITY inline
3797
+ basic_string<_CharT, _Traits, _Allocator>
3798
+ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs)
3799
+ {
3800
+ return _VSTD::move(__lhs.append(__rhs));
3801
+ }
3802
+
3803
+ template<class _CharT, class _Traits, class _Allocator>
3804
+ _LIBCPP_INLINE_VISIBILITY inline
3805
+ basic_string<_CharT, _Traits, _Allocator>
3806
+ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
3807
+ {
3808
+ return _VSTD::move(__rhs.insert(0, __lhs));
3809
+ }
3810
+
3811
+ template<class _CharT, class _Traits, class _Allocator>
3812
+ _LIBCPP_INLINE_VISIBILITY inline
3813
+ basic_string<_CharT, _Traits, _Allocator>
3814
+ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs)
3815
+ {
3816
+ return _VSTD::move(__lhs.append(__rhs));
3817
+ }
3818
+
3819
+ template<class _CharT, class _Traits, class _Allocator>
3820
+ _LIBCPP_INLINE_VISIBILITY inline
3821
+ basic_string<_CharT, _Traits, _Allocator>
3822
+ operator+(const _CharT* __lhs , basic_string<_CharT,_Traits,_Allocator>&& __rhs)
3823
+ {
3824
+ return _VSTD::move(__rhs.insert(0, __lhs));
3825
+ }
3826
+
3827
+ template<class _CharT, class _Traits, class _Allocator>
3828
+ _LIBCPP_INLINE_VISIBILITY inline
3829
+ basic_string<_CharT, _Traits, _Allocator>
3830
+ operator+(_CharT __lhs, basic_string<_CharT,_Traits,_Allocator>&& __rhs)
3831
+ {
3832
+ __rhs.insert(__rhs.begin(), __lhs);
3833
+ return _VSTD::move(__rhs);
3834
+ }
3835
+
3836
+ template<class _CharT, class _Traits, class _Allocator>
3837
+ _LIBCPP_INLINE_VISIBILITY inline
3838
+ basic_string<_CharT, _Traits, _Allocator>
3839
+ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, const _CharT* __rhs)
3840
+ {
3841
+ return _VSTD::move(__lhs.append(__rhs));
3842
+ }
3843
+
3844
+ template<class _CharT, class _Traits, class _Allocator>
3845
+ _LIBCPP_INLINE_VISIBILITY inline
3846
+ basic_string<_CharT, _Traits, _Allocator>
3847
+ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
3848
+ {
3849
+ __lhs.push_back(__rhs);
3850
+ return _VSTD::move(__lhs);
3851
+ }
3852
+
3853
+ #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3854
+
3855
+ // swap
3856
+
3857
+ template<class _CharT, class _Traits, class _Allocator>
3858
+ _LIBCPP_INLINE_VISIBILITY inline
3859
+ void
3860
+ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
3861
+ basic_string<_CharT, _Traits, _Allocator>& __rhs)
3862
+ _NOEXCEPT_(_NOEXCEPT_(__lhs.swap(__rhs)))
3863
+ {
3864
+ __lhs.swap(__rhs);
3865
+ }
3866
+
3867
+ #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
3868
+
3869
+ typedef basic_string<char16_t> u16string;
3870
+ typedef basic_string<char32_t> u32string;
3871
+
3872
+ #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
3873
+
3874
+ int stoi (const string& __str, size_t* __idx = 0, int __base = 10);
3875
+ long stol (const string& __str, size_t* __idx = 0, int __base = 10);
3876
+ unsigned long stoul (const string& __str, size_t* __idx = 0, int __base = 10);
3877
+ long long stoll (const string& __str, size_t* __idx = 0, int __base = 10);
3878
+ unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
3879
+
3880
+ float stof (const string& __str, size_t* __idx = 0);
3881
+ double stod (const string& __str, size_t* __idx = 0);
3882
+ long double stold(const string& __str, size_t* __idx = 0);
3883
+
3884
+ string to_string(int __val);
3885
+ string to_string(unsigned __val);
3886
+ string to_string(long __val);
3887
+ string to_string(unsigned long __val);
3888
+ string to_string(long long __val);
3889
+ string to_string(unsigned long long __val);
3890
+ string to_string(float __val);
3891
+ string to_string(double __val);
3892
+ string to_string(long double __val);
3893
+
3894
+ int stoi (const wstring& __str, size_t* __idx = 0, int __base = 10);
3895
+ long stol (const wstring& __str, size_t* __idx = 0, int __base = 10);
3896
+ unsigned long stoul (const wstring& __str, size_t* __idx = 0, int __base = 10);
3897
+ long long stoll (const wstring& __str, size_t* __idx = 0, int __base = 10);
3898
+ unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10);
3899
+
3900
+ float stof (const wstring& __str, size_t* __idx = 0);
3901
+ double stod (const wstring& __str, size_t* __idx = 0);
3902
+ long double stold(const wstring& __str, size_t* __idx = 0);
3903
+
3904
+ wstring to_wstring(int __val);
3905
+ wstring to_wstring(unsigned __val);
3906
+ wstring to_wstring(long __val);
3907
+ wstring to_wstring(unsigned long __val);
3908
+ wstring to_wstring(long long __val);
3909
+ wstring to_wstring(unsigned long long __val);
3910
+ wstring to_wstring(float __val);
3911
+ wstring to_wstring(double __val);
3912
+ wstring to_wstring(long double __val);
3913
+
3914
+ template<class _CharT, class _Traits, class _Allocator>
3915
+ const typename basic_string<_CharT, _Traits, _Allocator>::size_type
3916
+ basic_string<_CharT, _Traits, _Allocator>::npos;
3917
+
3918
+ template<class _Ptr>
3919
+ size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
3920
+ {
3921
+ typedef typename iterator_traits<_Ptr>::value_type value_type;
3922
+ return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
3923
+ }
3924
+
3925
+ template<class _CharT, class _Traits, class _Allocator>
3926
+ struct _LIBCPP_TYPE_VIS hash<basic_string<_CharT, _Traits, _Allocator> >
3927
+ : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
3928
+ {
3929
+ size_t
3930
+ operator()(const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT;
3931
+ };
3932
+
3933
+ template<class _CharT, class _Traits, class _Allocator>
3934
+ size_t
3935
+ hash<basic_string<_CharT, _Traits, _Allocator> >::operator()(
3936
+ const basic_string<_CharT, _Traits, _Allocator>& __val) const _NOEXCEPT
3937
+ {
3938
+ return __do_string_hash(__val.data(), __val.data() + __val.size());
3939
+ }
3940
+
3941
+ template<class _CharT, class _Traits, class _Allocator>
3942
+ basic_ostream<_CharT, _Traits>&
3943
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
3944
+ const basic_string<_CharT, _Traits, _Allocator>& __str);
3945
+
3946
+ template<class _CharT, class _Traits, class _Allocator>
3947
+ basic_istream<_CharT, _Traits>&
3948
+ operator>>(basic_istream<_CharT, _Traits>& __is,
3949
+ basic_string<_CharT, _Traits, _Allocator>& __str);
3950
+
3951
+ template<class _CharT, class _Traits, class _Allocator>
3952
+ basic_istream<_CharT, _Traits>&
3953
+ getline(basic_istream<_CharT, _Traits>& __is,
3954
+ basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
3955
+
3956
+ template<class _CharT, class _Traits, class _Allocator>
3957
+ inline _LIBCPP_INLINE_VISIBILITY
3958
+ basic_istream<_CharT, _Traits>&
3959
+ getline(basic_istream<_CharT, _Traits>& __is,
3960
+ basic_string<_CharT, _Traits, _Allocator>& __str);
3961
+
3962
+ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
3963
+
3964
+ template<class _CharT, class _Traits, class _Allocator>
3965
+ inline _LIBCPP_INLINE_VISIBILITY
3966
+ basic_istream<_CharT, _Traits>&
3967
+ getline(basic_istream<_CharT, _Traits>&& __is,
3968
+ basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm);
3969
+
3970
+ template<class _CharT, class _Traits, class _Allocator>
3971
+ inline _LIBCPP_INLINE_VISIBILITY
3972
+ basic_istream<_CharT, _Traits>&
3973
+ getline(basic_istream<_CharT, _Traits>&& __is,
3974
+ basic_string<_CharT, _Traits, _Allocator>& __str);
3975
+
3976
+ #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
3977
+
3978
+ _LIBCPP_EXTERN_TEMPLATE(class basic_string<char>)
3979
+ _LIBCPP_EXTERN_TEMPLATE(class basic_string<wchar_t>)
3980
+
3981
+ extern template
3982
+ string
3983
+ operator+<char, char_traits<char>, allocator<char> >(char const*, string const&);
3984
+
3985
+ _LIBCPP_END_NAMESPACE_STD
3986
+
3987
+ #endif // _LIBCPP_STRING