webruby 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webruby/rake/mruby.rake +1 -0
- data/modules/emscripten/AUTHORS +7 -0
- data/modules/emscripten/LICENSE +26 -0
- data/modules/emscripten/emcc +58 -20
- data/modules/emscripten/emlink.py +2 -265
- data/modules/emscripten/emscripten.py +38 -18
- data/modules/emscripten/scons-tools/emscripten.py +11 -6
- data/modules/emscripten/scons-tools/llvm.py +4 -3
- data/modules/emscripten/src/analyzer.js +32 -13
- data/modules/emscripten/src/embind/embind.js +13 -13
- data/modules/emscripten/src/embind/emval.js +8 -7
- data/modules/emscripten/src/intertyper.js +10 -0
- data/modules/emscripten/src/jsifier.js +28 -6
- data/modules/emscripten/src/library.js +2949 -1322
- data/modules/emscripten/src/library_browser.js +27 -23
- data/modules/emscripten/src/library_egl.js +7 -2
- data/modules/emscripten/src/library_gl.js +15 -2
- data/modules/emscripten/src/library_glut.js +1 -1
- data/modules/emscripten/src/library_jansson.js +1 -1
- data/modules/emscripten/src/library_openal.js +464 -132
- data/modules/emscripten/src/library_path.js +134 -0
- data/modules/emscripten/src/library_sdl.js +222 -50
- data/modules/emscripten/src/modules.js +22 -5
- data/modules/emscripten/src/parseTools.js +13 -2
- data/modules/emscripten/src/postamble.js +60 -34
- data/modules/emscripten/src/preamble.js +67 -18
- data/modules/emscripten/src/relooper/Relooper.cpp +1 -1
- data/modules/emscripten/src/runtime.js +12 -2
- data/modules/emscripten/src/settings.js +869 -826
- data/modules/emscripten/src/shell.js +63 -51
- data/modules/emscripten/src/utility.js +6 -0
- data/modules/emscripten/system/include/bsd/sys/mman.h +1 -1
- data/modules/emscripten/system/include/emscripten/bind.h +28 -28
- data/modules/emscripten/system/include/libc/math.h +8 -0
- data/modules/emscripten/system/include/libc/sys/signal.h +3 -1
- data/modules/emscripten/system/include/libc/sys/stat.h +2 -1
- data/modules/emscripten/system/include/libc/sys/types.h +4 -0
- data/modules/emscripten/system/include/libcxx/CREDITS.TXT +24 -0
- data/modules/emscripten/system/include/libcxx/__bit_reference +27 -8
- data/modules/emscripten/system/include/libcxx/__config +62 -15
- data/modules/emscripten/system/include/libcxx/__debug +5 -1
- data/modules/emscripten/system/include/libcxx/__functional_03 +24 -24
- data/modules/emscripten/system/include/libcxx/__functional_base +22 -4
- data/modules/emscripten/system/include/libcxx/__hash_table +566 -54
- data/modules/emscripten/system/include/libcxx/__locale +11 -3
- data/modules/emscripten/system/include/libcxx/__split_buffer +6 -6
- data/modules/emscripten/system/include/libcxx/__std_stream +58 -30
- data/modules/emscripten/system/include/libcxx/__tree +58 -51
- data/modules/emscripten/system/include/libcxx/__tuple +9 -9
- data/modules/emscripten/system/include/libcxx/algorithm +223 -13
- data/modules/emscripten/system/include/libcxx/array +18 -17
- data/modules/emscripten/system/include/libcxx/atomic +15 -5
- data/modules/emscripten/system/include/libcxx/cctype +2 -2
- data/modules/emscripten/system/include/libcxx/chrono +131 -36
- data/modules/emscripten/system/include/libcxx/cmath +41 -36
- data/modules/emscripten/system/include/libcxx/complex +49 -49
- data/modules/emscripten/system/include/libcxx/cstdio +2 -2
- data/modules/emscripten/system/include/libcxx/cstdlib +5 -5
- data/modules/emscripten/system/include/libcxx/cstring +2 -2
- data/modules/emscripten/system/include/libcxx/cwchar +22 -13
- data/modules/emscripten/system/include/libcxx/deque +27 -14
- data/modules/emscripten/system/include/libcxx/forward_list +36 -35
- data/modules/emscripten/system/include/libcxx/fstream +16 -0
- data/modules/emscripten/system/include/libcxx/functional +348 -23
- data/modules/emscripten/system/include/libcxx/future +66 -0
- data/modules/emscripten/system/include/libcxx/ios +27 -0
- data/modules/emscripten/system/include/libcxx/istream +2 -4
- data/modules/emscripten/system/include/libcxx/iterator +17 -9
- data/modules/emscripten/system/include/libcxx/limits +2 -2
- data/modules/emscripten/system/include/libcxx/list +165 -105
- data/modules/emscripten/system/include/libcxx/locale +154 -43
- data/modules/emscripten/system/include/libcxx/map +165 -224
- data/modules/emscripten/system/include/libcxx/memory +113 -54
- data/modules/emscripten/system/include/libcxx/random +2 -29
- data/modules/emscripten/system/include/libcxx/readme.txt +1 -1
- data/modules/emscripten/system/include/libcxx/regex +60 -15
- data/modules/emscripten/system/include/libcxx/sstream +124 -40
- data/modules/emscripten/system/include/libcxx/string +345 -182
- data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +3 -3
- data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +15 -2
- data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +3 -3
- data/modules/emscripten/system/include/libcxx/support/win32/support.h +10 -11
- data/modules/emscripten/system/include/libcxx/thread +2 -2
- data/modules/emscripten/system/include/libcxx/tuple +134 -65
- data/modules/emscripten/system/include/libcxx/type_traits +232 -24
- data/modules/emscripten/system/include/libcxx/unordered_map +314 -161
- data/modules/emscripten/system/include/libcxx/unordered_set +160 -2
- data/modules/emscripten/system/include/libcxx/utility +225 -40
- data/modules/emscripten/system/include/libcxx/vector +52 -57
- data/modules/emscripten/system/include/net/if.h +20 -1
- data/modules/emscripten/system/include/net/netinet/in.h +69 -5
- data/modules/emscripten/system/include/netdb.h +36 -0
- data/modules/emscripten/system/include/sys/ioctl.h +55 -3
- data/modules/emscripten/system/include/sys/select.h +2 -0
- data/modules/emscripten/system/include/sys/sendfile.h +16 -0
- data/modules/emscripten/system/include/sys/socket.h +181 -35
- data/modules/emscripten/system/lib/dlmalloc.c +10 -12
- data/modules/emscripten/system/lib/libc/musl/src/stdlib/ecvt.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/stdlib/fcvt.c +25 -0
- data/modules/emscripten/system/lib/libc/musl/src/stdlib/gcvt.c +8 -0
- data/modules/emscripten/system/lib/libcextra.symbols +3 -0
- data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +24 -0
- data/modules/emscripten/system/lib/libcxx/debug.cpp +11 -9
- data/modules/emscripten/system/lib/libcxx/exception.cpp +9 -0
- data/modules/emscripten/system/lib/libcxx/hash.cpp +6 -0
- data/modules/emscripten/system/lib/libcxx/iostream.cpp +4 -4
- data/modules/emscripten/system/lib/libcxx/locale.cpp +91 -42
- data/modules/emscripten/system/lib/libcxx/readme.txt +1 -1
- data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +1 -1
- data/modules/emscripten/system/lib/libcxx/string.cpp +332 -491
- data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +4 -2
- data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +140 -41
- data/modules/emscripten/system/lib/libcxx/symbols +9 -256
- data/modules/emscripten/system/lib/libcxx/system_error.cpp +3 -0
- data/modules/emscripten/system/lib/libcxx/thread.cpp +16 -3
- data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +12 -2
- data/modules/emscripten/third_party/stb_image.c +4673 -0
- data/modules/emscripten/tools/asm_module.py +273 -0
- data/modules/emscripten/tools/exec_llvm.py +2 -2
- data/modules/emscripten/tools/file_packager.py +36 -16
- data/modules/emscripten/tools/find_bigfuncs.py +9 -9
- data/modules/emscripten/tools/js-optimizer.js +485 -131
- data/modules/emscripten/tools/js_optimizer.py +22 -15
- data/modules/emscripten/tools/merge_asm.py +26 -0
- data/modules/emscripten/tools/nativize_llvm.py +2 -2
- data/modules/emscripten/tools/settings_template_readonly.py +1 -1
- data/modules/emscripten/tools/shared.py +63 -20
- data/modules/emscripten/tools/split_asm.py +30 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline1-output.js +686 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline1.js +263 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline2-output.js +747 -0
- data/modules/emscripten/tools/{test-js-optimizer-asm-outline.js → test-js-optimizer-asm-outline2.js} +1 -1
- data/modules/emscripten/tools/test-js-optimizer-asm-outline3-output.js +28 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline3.js +30 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre-output.js +4 -4
- data/modules/mruby/AUTHORS +1 -0
- data/modules/mruby/README.md +4 -2
- data/modules/mruby/build_config.rb +6 -6
- data/modules/mruby/doc/mrbgems/README.md +4 -4
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +1 -1
- data/modules/mruby/examples/mrbgems/c_extension_example/mrbgem.rake +1 -1
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake +1 -1
- data/modules/mruby/include/mrbconf.h +3 -0
- data/modules/mruby/include/mruby/array.h +2 -2
- data/modules/mruby/include/mruby/class.h +4 -4
- data/modules/mruby/include/mruby/compile.h +1 -0
- data/modules/mruby/include/mruby/data.h +1 -1
- data/modules/mruby/include/mruby/hash.h +2 -2
- data/modules/mruby/include/mruby/irep.h +3 -2
- data/modules/mruby/include/mruby/proc.h +1 -1
- data/modules/mruby/include/mruby/range.h +1 -1
- data/modules/mruby/include/mruby/string.h +2 -2
- data/modules/mruby/include/mruby/value.h +43 -26
- data/modules/mruby/include/mruby.h +10 -2
- data/modules/mruby/minirake +2 -2
- data/modules/mruby/mrbgems/mruby-array-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +4 -1
- data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +32 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +13 -5
- data/modules/mruby/mrbgems/mruby-enum-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-enum-ext/test/enum.rb +10 -11
- data/modules/mruby/mrbgems/mruby-eval/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-exit/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-exit/src/mruby-exit.c +24 -0
- data/modules/mruby/mrbgems/mruby-fiber/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +4 -2
- data/modules/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-hash-ext/test/hash.rb +5 -7
- data/modules/mruby/mrbgems/mruby-math/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +2 -2
- data/modules/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-object-ext/src/object.c +3 -3
- data/modules/mruby/mrbgems/mruby-object-ext/test/nil.rb +3 -3
- data/modules/mruby/mrbgems/mruby-object-ext/test/object.rb +1 -1
- data/modules/mruby/mrbgems/mruby-objectspace/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +36 -37
- data/modules/mruby/mrbgems/mruby-print/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-proc-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.rb +8 -8
- data/modules/mruby/mrbgems/mruby-random/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-range-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-range-ext/test/range.rb +6 -6
- data/modules/mruby/mrbgems/mruby-sprintf/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-string-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +6 -6
- data/modules/mruby/mrbgems/mruby-struct/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +2 -2
- data/modules/mruby/mrbgems/mruby-time/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-time/src/time.c +2 -8
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake +1 -1
- data/modules/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb +10 -10
- data/modules/mruby/mrblib/class.rb +15 -9
- data/modules/mruby/mrblib/string.rb +12 -0
- data/modules/mruby/src/array.c +4 -3
- data/modules/mruby/src/class.c +13 -8
- data/modules/mruby/src/codegen.c +9 -8
- data/modules/mruby/src/error.c +7 -5
- data/modules/mruby/src/error.h +1 -0
- data/modules/mruby/src/etc.c +1 -1
- data/modules/mruby/src/gc.c +163 -128
- data/modules/mruby/src/kernel.c +43 -15
- data/modules/mruby/src/numeric.c +9 -7
- data/modules/mruby/src/object.c +1 -1
- data/modules/mruby/src/parse.y +37 -19
- data/modules/mruby/src/range.c +10 -24
- data/modules/mruby/src/state.c +2 -6
- data/modules/mruby/src/string.c +0 -9
- data/modules/mruby/src/variable.c +2 -2
- data/modules/mruby/src/vm.c +12 -6
- data/modules/mruby/tasks/mrbgem_spec.rake +7 -0
- data/modules/mruby/tasks/mrbgems.rake +2 -1
- data/modules/mruby/tasks/mrbgems_test.rake +1 -1
- data/modules/mruby/tasks/mruby_build.rake +4 -3
- data/modules/mruby/tasks/mruby_build_commands.rake +6 -1
- data/modules/mruby/tasks/mruby_build_gem.rake +2 -2
- data/modules/mruby/tasks/toolchains/androideabi.rake +2 -0
- data/modules/mruby/test/assert.rb +2 -2
- data/modules/mruby/test/t/argumenterror.rb +3 -3
- data/modules/mruby/test/t/array.rb +55 -55
- data/modules/mruby/test/t/basicobject.rb +1 -1
- data/modules/mruby/test/t/bs_block.rb +12 -12
- data/modules/mruby/test/t/class.rb +21 -21
- data/modules/mruby/test/t/enumerable.rb +18 -18
- data/modules/mruby/test/t/exception.rb +20 -20
- data/modules/mruby/test/t/false.rb +3 -3
- data/modules/mruby/test/t/float.rb +40 -40
- data/modules/mruby/test/t/gc.rb +10 -10
- data/modules/mruby/test/t/hash.rb +41 -41
- data/modules/mruby/test/t/indexerror.rb +2 -2
- data/modules/mruby/test/t/integer.rb +41 -41
- data/modules/mruby/test/t/kernel.rb +33 -33
- data/modules/mruby/test/t/literals.rb +82 -82
- data/modules/mruby/test/t/localjumperror.rb +1 -1
- data/modules/mruby/test/t/module.rb +170 -31
- data/modules/mruby/test/t/nameerror.rb +5 -5
- data/modules/mruby/test/t/nil.rb +2 -2
- data/modules/mruby/test/t/nomethoderror.rb +1 -1
- data/modules/mruby/test/t/numeric.rb +5 -5
- data/modules/mruby/test/t/object.rb +2 -2
- data/modules/mruby/test/t/proc.rb +8 -8
- data/modules/mruby/test/t/range.rb +9 -9
- data/modules/mruby/test/t/rangeerror.rb +2 -2
- data/modules/mruby/test/t/runtimeerror.rb +1 -1
- data/modules/mruby/test/t/standarderror.rb +2 -2
- data/modules/mruby/test/t/string.rb +100 -100
- data/modules/mruby/test/t/symbol.rb +5 -5
- data/modules/mruby/test/t/syntax.rb +15 -6
- data/modules/mruby/test/t/true.rb +3 -3
- data/modules/mruby/test/t/typeerror.rb +2 -2
- data/modules/mruby/tools/mrbc/mrbc.c +10 -4
- data/modules/mruby/travis_config.rb +1 -0
- data/scripts/gen_gems_config.rb +5 -1
- metadata +19 -4
- data/modules/emscripten/tools/test-js-optimizer-asm-outline-output.js +0 -570
@@ -100,8 +100,8 @@ public:
|
|
100
100
|
noexcept(is_nothrow_move_constructible<allocator_type>::value);
|
101
101
|
basic_string(const basic_string& str, size_type pos, size_type n = npos,
|
102
102
|
const allocator_type& a = allocator_type());
|
103
|
-
basic_string(
|
104
|
-
basic_string(
|
103
|
+
basic_string(const value_type* s, const allocator_type& a = allocator_type());
|
104
|
+
basic_string(const value_type* s, size_type n, const allocator_type& a = allocator_type());
|
105
105
|
basic_string(size_type n, value_type c, const allocator_type& a = allocator_type());
|
106
106
|
template<class InputIterator>
|
107
107
|
basic_string(InputIterator begin, InputIterator end,
|
@@ -117,7 +117,7 @@ public:
|
|
117
117
|
noexcept(
|
118
118
|
allocator_type::propagate_on_container_move_assignment::value &&
|
119
119
|
is_nothrow_move_assignable<allocator_type>::value);
|
120
|
-
basic_string& operator=(
|
120
|
+
basic_string& operator=(const value_type* s);
|
121
121
|
basic_string& operator=(value_type c);
|
122
122
|
basic_string& operator=(initializer_list<value_type>);
|
123
123
|
|
@@ -156,14 +156,14 @@ public:
|
|
156
156
|
reference at(size_type n);
|
157
157
|
|
158
158
|
basic_string& operator+=(const basic_string& str);
|
159
|
-
basic_string& operator+=(
|
159
|
+
basic_string& operator+=(const value_type* s);
|
160
160
|
basic_string& operator+=(value_type c);
|
161
161
|
basic_string& operator+=(initializer_list<value_type>);
|
162
162
|
|
163
163
|
basic_string& append(const basic_string& str);
|
164
164
|
basic_string& append(const basic_string& str, size_type pos, size_type n);
|
165
|
-
basic_string& append(
|
166
|
-
basic_string& append(
|
165
|
+
basic_string& append(const value_type* s, size_type n);
|
166
|
+
basic_string& append(const value_type* s);
|
167
167
|
basic_string& append(size_type n, value_type c);
|
168
168
|
template<class InputIterator>
|
169
169
|
basic_string& append(InputIterator first, InputIterator last);
|
@@ -179,8 +179,8 @@ public:
|
|
179
179
|
basic_string& assign(const basic_string& str);
|
180
180
|
basic_string& assign(basic_string&& str);
|
181
181
|
basic_string& assign(const basic_string& str, size_type pos, size_type n);
|
182
|
-
basic_string& assign(
|
183
|
-
basic_string& assign(
|
182
|
+
basic_string& assign(const value_type* s, size_type n);
|
183
|
+
basic_string& assign(const value_type* s);
|
184
184
|
basic_string& assign(size_type n, value_type c);
|
185
185
|
template<class InputIterator>
|
186
186
|
basic_string& assign(InputIterator first, InputIterator last);
|
@@ -189,8 +189,8 @@ public:
|
|
189
189
|
basic_string& insert(size_type pos1, const basic_string& str);
|
190
190
|
basic_string& insert(size_type pos1, const basic_string& str,
|
191
191
|
size_type pos2, size_type n);
|
192
|
-
basic_string& insert(size_type pos,
|
193
|
-
basic_string& insert(size_type pos,
|
192
|
+
basic_string& insert(size_type pos, const value_type* s, size_type n);
|
193
|
+
basic_string& insert(size_type pos, const value_type* s);
|
194
194
|
basic_string& insert(size_type pos, size_type n, value_type c);
|
195
195
|
iterator insert(const_iterator p, value_type c);
|
196
196
|
iterator insert(const_iterator p, size_type n, value_type c);
|
@@ -205,66 +205,66 @@ public:
|
|
205
205
|
basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
|
206
206
|
basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
|
207
207
|
size_type pos2, size_type n2);
|
208
|
-
basic_string& replace(size_type pos, size_type n1,
|
209
|
-
basic_string& replace(size_type pos, size_type n1,
|
208
|
+
basic_string& replace(size_type pos, size_type n1, const value_type* s, size_type n2);
|
209
|
+
basic_string& replace(size_type pos, size_type n1, const value_type* s);
|
210
210
|
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
|
211
211
|
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
212
|
-
basic_string& replace(const_iterator i1, const_iterator i2,
|
213
|
-
basic_string& replace(const_iterator i1, const_iterator i2,
|
212
|
+
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s, size_type n);
|
213
|
+
basic_string& replace(const_iterator i1, const_iterator i2, const value_type* s);
|
214
214
|
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
|
215
215
|
template<class InputIterator>
|
216
216
|
basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
|
217
217
|
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
|
218
218
|
|
219
|
-
size_type copy(
|
219
|
+
size_type copy(value_type* s, size_type n, size_type pos = 0) const;
|
220
220
|
basic_string substr(size_type pos = 0, size_type n = npos) const;
|
221
221
|
|
222
222
|
void swap(basic_string& str)
|
223
223
|
noexcept(!allocator_type::propagate_on_container_swap::value ||
|
224
224
|
__is_nothrow_swappable<allocator_type>::value)
|
225
225
|
|
226
|
-
|
227
|
-
|
226
|
+
const value_type* c_str() const noexcept;
|
227
|
+
const value_type* data() const noexcept;
|
228
228
|
|
229
229
|
allocator_type get_allocator() const noexcept;
|
230
230
|
|
231
231
|
size_type find(const basic_string& str, size_type pos = 0) const noexcept;
|
232
|
-
size_type find(
|
233
|
-
size_type find(
|
232
|
+
size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
|
233
|
+
size_type find(const value_type* s, size_type pos = 0) const noexcept;
|
234
234
|
size_type find(value_type c, size_type pos = 0) const noexcept;
|
235
235
|
|
236
236
|
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
|
237
|
-
size_type rfind(
|
238
|
-
size_type rfind(
|
237
|
+
size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
|
238
|
+
size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
|
239
239
|
size_type rfind(value_type c, size_type pos = npos) const noexcept;
|
240
240
|
|
241
241
|
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
|
242
|
-
size_type find_first_of(
|
243
|
-
size_type find_first_of(
|
242
|
+
size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
243
|
+
size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
|
244
244
|
size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
|
245
245
|
|
246
246
|
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
|
247
|
-
size_type find_last_of(
|
248
|
-
size_type find_last_of(
|
247
|
+
size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
248
|
+
size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
|
249
249
|
size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
|
250
250
|
|
251
251
|
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
|
252
|
-
size_type find_first_not_of(
|
253
|
-
size_type find_first_not_of(
|
252
|
+
size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
253
|
+
size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
|
254
254
|
size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
|
255
255
|
|
256
256
|
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
|
257
|
-
size_type find_last_not_of(
|
258
|
-
size_type find_last_not_of(
|
257
|
+
size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
|
258
|
+
size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
|
259
259
|
size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
|
260
260
|
|
261
261
|
int compare(const basic_string& str) const noexcept;
|
262
262
|
int compare(size_type pos1, size_type n1, const basic_string& str) const;
|
263
263
|
int compare(size_type pos1, size_type n1, const basic_string& str,
|
264
264
|
size_type pos2, size_type n2) const;
|
265
|
-
int compare(
|
266
|
-
int compare(size_type pos1, size_type n1,
|
267
|
-
int compare(size_type pos1, size_type n1,
|
265
|
+
int compare(const value_type* s) const noexcept;
|
266
|
+
int compare(size_type pos1, size_type n1, const value_type* s) const;
|
267
|
+
int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const;
|
268
268
|
|
269
269
|
bool __invariants() const;
|
270
270
|
};
|
@@ -422,6 +422,11 @@ template <> struct hash<u16string>;
|
|
422
422
|
template <> struct hash<u32string>;
|
423
423
|
template <> struct hash<wstring>;
|
424
424
|
|
425
|
+
basic_string<char> operator "" s( const char *str, size_t len ); // C++14
|
426
|
+
basic_string<wchar_t> operator "" s( const wchar_t *str, size_t len ); // C++14
|
427
|
+
basic_string<char16_t> operator "" s( const char16_t *str, size_t len ); // C++14
|
428
|
+
basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++14
|
429
|
+
|
425
430
|
} // std
|
426
431
|
|
427
432
|
*/
|
@@ -1027,14 +1032,29 @@ __basic_string_common<__b>::__throw_out_of_range() const
|
|
1027
1032
|
#endif
|
1028
1033
|
}
|
1029
1034
|
|
1030
|
-
#ifdef
|
1035
|
+
#ifdef _LIBCPP_MSVC
|
1031
1036
|
#pragma warning( push )
|
1032
1037
|
#pragma warning( disable: 4231 )
|
1033
|
-
#endif //
|
1038
|
+
#endif // _LIBCPP_MSVC
|
1034
1039
|
_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
|
1035
|
-
#ifdef
|
1040
|
+
#ifdef _LIBCPP_MSVC
|
1036
1041
|
#pragma warning( pop )
|
1037
|
-
#endif //
|
1042
|
+
#endif // _LIBCPP_MSVC
|
1043
|
+
|
1044
|
+
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1045
|
+
|
1046
|
+
template <class _CharT, size_t = sizeof(_CharT)>
|
1047
|
+
struct __padding
|
1048
|
+
{
|
1049
|
+
unsigned char __xx[sizeof(_CharT)-1];
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
template <class _CharT>
|
1053
|
+
struct __padding<_CharT, 1>
|
1054
|
+
{
|
1055
|
+
};
|
1056
|
+
|
1057
|
+
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1038
1058
|
|
1039
1059
|
template<class _CharT, class _Traits, class _Allocator>
|
1040
1060
|
class _LIBCPP_TYPE_VIS basic_string
|
@@ -1069,6 +1089,39 @@ public:
|
|
1069
1089
|
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
1070
1090
|
|
1071
1091
|
private:
|
1092
|
+
|
1093
|
+
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1094
|
+
|
1095
|
+
struct __long
|
1096
|
+
{
|
1097
|
+
pointer __data_;
|
1098
|
+
size_type __size_;
|
1099
|
+
size_type __cap_;
|
1100
|
+
};
|
1101
|
+
|
1102
|
+
#if _LIBCPP_BIG_ENDIAN
|
1103
|
+
enum {__short_mask = 0x01};
|
1104
|
+
enum {__long_mask = 0x1ul};
|
1105
|
+
#else // _LIBCPP_BIG_ENDIAN
|
1106
|
+
enum {__short_mask = 0x80};
|
1107
|
+
enum {__long_mask = ~(size_type(~0) >> 1)};
|
1108
|
+
#endif // _LIBCPP_BIG_ENDIAN
|
1109
|
+
|
1110
|
+
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
|
1111
|
+
(sizeof(__long) - 1)/sizeof(value_type) : 2};
|
1112
|
+
|
1113
|
+
struct __short
|
1114
|
+
{
|
1115
|
+
value_type __data_[__min_cap];
|
1116
|
+
struct
|
1117
|
+
: __padding<value_type>
|
1118
|
+
{
|
1119
|
+
unsigned char __size_;
|
1120
|
+
};
|
1121
|
+
};
|
1122
|
+
|
1123
|
+
#else
|
1124
|
+
|
1072
1125
|
struct __long
|
1073
1126
|
{
|
1074
1127
|
size_type __cap_;
|
@@ -1084,8 +1137,6 @@ private:
|
|
1084
1137
|
enum {__long_mask = 0x1ul};
|
1085
1138
|
#endif // _LIBCPP_BIG_ENDIAN
|
1086
1139
|
|
1087
|
-
enum {__mask = size_type(~0) >> 1};
|
1088
|
-
|
1089
1140
|
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
|
1090
1141
|
(sizeof(__long) - 1)/sizeof(value_type) : 2};
|
1091
1142
|
|
@@ -1099,6 +1150,8 @@ private:
|
|
1099
1150
|
value_type __data_[__min_cap];
|
1100
1151
|
};
|
1101
1152
|
|
1153
|
+
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1154
|
+
|
1102
1155
|
union __lx{__long __lx; __short __lxx;};
|
1103
1156
|
|
1104
1157
|
enum {__n_words = sizeof(__lx) / sizeof(size_type)};
|
@@ -1144,13 +1197,13 @@ public:
|
|
1144
1197
|
_LIBCPP_INLINE_VISIBILITY
|
1145
1198
|
basic_string(basic_string&& __str, const allocator_type& __a);
|
1146
1199
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1147
|
-
_LIBCPP_INLINE_VISIBILITY basic_string(
|
1200
|
+
_LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
|
1148
1201
|
_LIBCPP_INLINE_VISIBILITY
|
1149
|
-
basic_string(
|
1202
|
+
basic_string(const value_type* __s, const allocator_type& __a);
|
1150
1203
|
_LIBCPP_INLINE_VISIBILITY
|
1151
|
-
basic_string(
|
1204
|
+
basic_string(const value_type* __s, size_type __n);
|
1152
1205
|
_LIBCPP_INLINE_VISIBILITY
|
1153
|
-
basic_string(
|
1206
|
+
basic_string(const value_type* __s, size_type __n, const allocator_type& __a);
|
1154
1207
|
_LIBCPP_INLINE_VISIBILITY
|
1155
1208
|
basic_string(size_type __n, value_type __c);
|
1156
1209
|
_LIBCPP_INLINE_VISIBILITY
|
@@ -1179,7 +1232,7 @@ public:
|
|
1179
1232
|
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
1180
1233
|
is_nothrow_move_assignable<allocator_type>::value);
|
1181
1234
|
#endif
|
1182
|
-
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(
|
1235
|
+
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
|
1183
1236
|
basic_string& operator=(value_type __c);
|
1184
1237
|
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
1185
1238
|
_LIBCPP_INLINE_VISIBILITY
|
@@ -1192,13 +1245,13 @@ public:
|
|
1192
1245
|
{return iterator(__get_pointer());}
|
1193
1246
|
_LIBCPP_INLINE_VISIBILITY
|
1194
1247
|
const_iterator begin() const _NOEXCEPT
|
1195
|
-
{return const_iterator(
|
1248
|
+
{return const_iterator(__get_pointer());}
|
1196
1249
|
_LIBCPP_INLINE_VISIBILITY
|
1197
1250
|
iterator end() _NOEXCEPT
|
1198
1251
|
{return iterator(__get_pointer() + size());}
|
1199
1252
|
_LIBCPP_INLINE_VISIBILITY
|
1200
1253
|
const_iterator end() const _NOEXCEPT
|
1201
|
-
{return const_iterator(
|
1254
|
+
{return const_iterator(__get_pointer() + size());}
|
1202
1255
|
#else // _LIBCPP_DEBUG
|
1203
1256
|
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(this, __get_pointer());}
|
1204
1257
|
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(this, data());}
|
@@ -1255,7 +1308,7 @@ public:
|
|
1255
1308
|
reference at(size_type __n);
|
1256
1309
|
|
1257
1310
|
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const basic_string& __str) {return append(__str);}
|
1258
|
-
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(
|
1311
|
+
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);}
|
1259
1312
|
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
|
1260
1313
|
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
1261
1314
|
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
|
@@ -1264,8 +1317,8 @@ public:
|
|
1264
1317
|
_LIBCPP_INLINE_VISIBILITY
|
1265
1318
|
basic_string& append(const basic_string& __str);
|
1266
1319
|
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
|
1267
|
-
basic_string& append(
|
1268
|
-
basic_string& append(
|
1320
|
+
basic_string& append(const value_type* __s, size_type __n);
|
1321
|
+
basic_string& append(const value_type* __s);
|
1269
1322
|
basic_string& append(size_type __n, value_type __c);
|
1270
1323
|
template<class _InputIterator>
|
1271
1324
|
typename enable_if
|
@@ -1303,8 +1356,8 @@ public:
|
|
1303
1356
|
{*this = _VSTD::move(str); return *this;}
|
1304
1357
|
#endif
|
1305
1358
|
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
|
1306
|
-
basic_string& assign(
|
1307
|
-
basic_string& assign(
|
1359
|
+
basic_string& assign(const value_type* __s, size_type __n);
|
1360
|
+
basic_string& assign(const value_type* __s);
|
1308
1361
|
basic_string& assign(size_type __n, value_type __c);
|
1309
1362
|
template<class _InputIterator>
|
1310
1363
|
typename enable_if
|
@@ -1329,8 +1382,8 @@ public:
|
|
1329
1382
|
_LIBCPP_INLINE_VISIBILITY
|
1330
1383
|
basic_string& insert(size_type __pos1, const basic_string& __str);
|
1331
1384
|
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
|
1332
|
-
basic_string& insert(size_type __pos,
|
1333
|
-
basic_string& insert(size_type __pos,
|
1385
|
+
basic_string& insert(size_type __pos, const value_type* __s, size_type __n);
|
1386
|
+
basic_string& insert(size_type __pos, const value_type* __s);
|
1334
1387
|
basic_string& insert(size_type __pos, size_type __n, value_type __c);
|
1335
1388
|
iterator insert(const_iterator __pos, value_type __c);
|
1336
1389
|
_LIBCPP_INLINE_VISIBILITY
|
@@ -1365,15 +1418,15 @@ public:
|
|
1365
1418
|
_LIBCPP_INLINE_VISIBILITY
|
1366
1419
|
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
|
1367
1420
|
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,
|
1369
|
-
basic_string& replace(size_type __pos, size_type __n1,
|
1421
|
+
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2);
|
1422
|
+
basic_string& replace(size_type __pos, size_type __n1, const value_type* __s);
|
1370
1423
|
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
|
1371
1424
|
_LIBCPP_INLINE_VISIBILITY
|
1372
1425
|
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
|
1373
1426
|
_LIBCPP_INLINE_VISIBILITY
|
1374
|
-
basic_string& replace(const_iterator __i1, const_iterator __i2,
|
1427
|
+
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n);
|
1375
1428
|
_LIBCPP_INLINE_VISIBILITY
|
1376
|
-
basic_string& replace(const_iterator __i1, const_iterator __i2,
|
1429
|
+
basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s);
|
1377
1430
|
_LIBCPP_INLINE_VISIBILITY
|
1378
1431
|
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
|
1379
1432
|
template<class _InputIterator>
|
@@ -1389,7 +1442,7 @@ public:
|
|
1389
1442
|
{return replace(__i1, __i2, __il.begin(), __il.end());}
|
1390
1443
|
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
1391
1444
|
|
1392
|
-
size_type copy(
|
1445
|
+
size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
|
1393
1446
|
_LIBCPP_INLINE_VISIBILITY
|
1394
1447
|
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
|
1395
1448
|
|
@@ -1399,56 +1452,56 @@ public:
|
|
1399
1452
|
__is_nothrow_swappable<allocator_type>::value);
|
1400
1453
|
|
1401
1454
|
_LIBCPP_INLINE_VISIBILITY
|
1402
|
-
|
1455
|
+
const value_type* c_str() const _NOEXCEPT {return data();}
|
1403
1456
|
_LIBCPP_INLINE_VISIBILITY
|
1404
|
-
|
1457
|
+
const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(__get_pointer());}
|
1405
1458
|
|
1406
1459
|
_LIBCPP_INLINE_VISIBILITY
|
1407
1460
|
allocator_type get_allocator() const _NOEXCEPT {return __alloc();}
|
1408
1461
|
|
1409
1462
|
_LIBCPP_INLINE_VISIBILITY
|
1410
1463
|
size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
1411
|
-
size_type find(
|
1464
|
+
size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
1412
1465
|
_LIBCPP_INLINE_VISIBILITY
|
1413
|
-
size_type find(
|
1466
|
+
size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
1414
1467
|
size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT;
|
1415
1468
|
|
1416
1469
|
_LIBCPP_INLINE_VISIBILITY
|
1417
1470
|
size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
1418
|
-
size_type rfind(
|
1471
|
+
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
1419
1472
|
_LIBCPP_INLINE_VISIBILITY
|
1420
|
-
size_type rfind(
|
1473
|
+
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
1421
1474
|
size_type rfind(value_type __c, size_type __pos = npos) const _NOEXCEPT;
|
1422
1475
|
|
1423
1476
|
_LIBCPP_INLINE_VISIBILITY
|
1424
1477
|
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
1425
|
-
size_type find_first_of(
|
1478
|
+
size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
1426
1479
|
_LIBCPP_INLINE_VISIBILITY
|
1427
|
-
size_type find_first_of(
|
1480
|
+
size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
1428
1481
|
_LIBCPP_INLINE_VISIBILITY
|
1429
1482
|
size_type find_first_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
|
1430
1483
|
|
1431
1484
|
_LIBCPP_INLINE_VISIBILITY
|
1432
1485
|
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
1433
|
-
size_type find_last_of(
|
1486
|
+
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
1434
1487
|
_LIBCPP_INLINE_VISIBILITY
|
1435
|
-
size_type find_last_of(
|
1488
|
+
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
1436
1489
|
_LIBCPP_INLINE_VISIBILITY
|
1437
1490
|
size_type find_last_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
|
1438
1491
|
|
1439
1492
|
_LIBCPP_INLINE_VISIBILITY
|
1440
1493
|
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT;
|
1441
|
-
size_type find_first_not_of(
|
1494
|
+
size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
1442
1495
|
_LIBCPP_INLINE_VISIBILITY
|
1443
|
-
size_type find_first_not_of(
|
1496
|
+
size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
|
1444
1497
|
_LIBCPP_INLINE_VISIBILITY
|
1445
1498
|
size_type find_first_not_of(value_type __c, size_type __pos = 0) const _NOEXCEPT;
|
1446
1499
|
|
1447
1500
|
_LIBCPP_INLINE_VISIBILITY
|
1448
1501
|
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT;
|
1449
|
-
size_type find_last_not_of(
|
1502
|
+
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
|
1450
1503
|
_LIBCPP_INLINE_VISIBILITY
|
1451
|
-
size_type find_last_not_of(
|
1504
|
+
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
|
1452
1505
|
_LIBCPP_INLINE_VISIBILITY
|
1453
1506
|
size_type find_last_not_of(value_type __c, size_type __pos = npos) const _NOEXCEPT;
|
1454
1507
|
|
@@ -1457,11 +1510,16 @@ public:
|
|
1457
1510
|
_LIBCPP_INLINE_VISIBILITY
|
1458
1511
|
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
|
1459
1512
|
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
|
1460
|
-
int compare(
|
1461
|
-
int compare(size_type __pos1, size_type __n1,
|
1462
|
-
int compare(size_type __pos1, size_type __n1,
|
1513
|
+
int compare(const value_type* __s) const _NOEXCEPT;
|
1514
|
+
int compare(size_type __pos1, size_type __n1, const value_type* __s) const;
|
1515
|
+
int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const;
|
1463
1516
|
|
1464
1517
|
_LIBCPP_INLINE_VISIBILITY bool __invariants() const;
|
1518
|
+
|
1519
|
+
_LIBCPP_INLINE_VISIBILITY
|
1520
|
+
bool __is_long() const _NOEXCEPT
|
1521
|
+
{return bool(__r_.first().__s.__size_ & __short_mask);}
|
1522
|
+
|
1465
1523
|
private:
|
1466
1524
|
_LIBCPP_INLINE_VISIBILITY
|
1467
1525
|
allocator_type& __alloc() _NOEXCEPT
|
@@ -1470,24 +1528,44 @@ private:
|
|
1470
1528
|
const allocator_type& __alloc() const _NOEXCEPT
|
1471
1529
|
{return __r_.second();}
|
1472
1530
|
|
1531
|
+
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1532
|
+
|
1473
1533
|
_LIBCPP_INLINE_VISIBILITY
|
1474
|
-
|
1475
|
-
|
1534
|
+
void __set_short_size(size_type __s) _NOEXCEPT
|
1535
|
+
# if _LIBCPP_BIG_ENDIAN
|
1536
|
+
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
|
1537
|
+
# else
|
1538
|
+
{__r_.first().__s.__size_ = (unsigned char)(__s);}
|
1539
|
+
# endif
|
1540
|
+
|
1541
|
+
_LIBCPP_INLINE_VISIBILITY
|
1542
|
+
size_type __get_short_size() const _NOEXCEPT
|
1543
|
+
# if _LIBCPP_BIG_ENDIAN
|
1544
|
+
{return __r_.first().__s.__size_ >> 1;}
|
1545
|
+
# else
|
1546
|
+
{return __r_.first().__s.__size_;}
|
1547
|
+
# endif
|
1548
|
+
|
1549
|
+
#else // _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1476
1550
|
|
1477
1551
|
_LIBCPP_INLINE_VISIBILITY
|
1478
1552
|
void __set_short_size(size_type __s) _NOEXCEPT
|
1479
|
-
#if _LIBCPP_BIG_ENDIAN
|
1553
|
+
# if _LIBCPP_BIG_ENDIAN
|
1480
1554
|
{__r_.first().__s.__size_ = (unsigned char)(__s);}
|
1481
|
-
#else
|
1555
|
+
# else
|
1482
1556
|
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
|
1483
|
-
#endif
|
1557
|
+
# endif
|
1558
|
+
|
1484
1559
|
_LIBCPP_INLINE_VISIBILITY
|
1485
1560
|
size_type __get_short_size() const _NOEXCEPT
|
1486
|
-
#if _LIBCPP_BIG_ENDIAN
|
1561
|
+
# if _LIBCPP_BIG_ENDIAN
|
1487
1562
|
{return __r_.first().__s.__size_;}
|
1488
|
-
#else
|
1563
|
+
# else
|
1489
1564
|
{return __r_.first().__s.__size_ >> 1;}
|
1490
|
-
#endif
|
1565
|
+
# endif
|
1566
|
+
|
1567
|
+
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
|
1568
|
+
|
1491
1569
|
_LIBCPP_INLINE_VISIBILITY
|
1492
1570
|
void __set_long_size(size_type __s) _NOEXCEPT
|
1493
1571
|
{__r_.first().__l.__size_ = __s;}
|
@@ -1516,10 +1594,10 @@ private:
|
|
1516
1594
|
{return __r_.first().__l.__data_;}
|
1517
1595
|
_LIBCPP_INLINE_VISIBILITY
|
1518
1596
|
pointer __get_short_pointer() _NOEXCEPT
|
1519
|
-
{return __r_.first().__s.__data_;}
|
1597
|
+
{return pointer_traits<pointer>::pointer_to(__r_.first().__s.__data_[0]);}
|
1520
1598
|
_LIBCPP_INLINE_VISIBILITY
|
1521
1599
|
const_pointer __get_short_pointer() const _NOEXCEPT
|
1522
|
-
{return __r_.first().__s.__data_;}
|
1600
|
+
{return pointer_traits<const_pointer>::pointer_to(__r_.first().__s.__data_[0]);}
|
1523
1601
|
_LIBCPP_INLINE_VISIBILITY
|
1524
1602
|
pointer __get_pointer() _NOEXCEPT
|
1525
1603
|
{return __is_long() ? __get_long_pointer() : __get_short_pointer();}
|
@@ -1546,8 +1624,8 @@ private:
|
|
1546
1624
|
__align<sizeof(value_type) < __alignment ?
|
1547
1625
|
__alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
|
1548
1626
|
|
1549
|
-
void __init(
|
1550
|
-
void __init(
|
1627
|
+
void __init(const value_type* __s, size_type __sz, size_type __reserve);
|
1628
|
+
void __init(const value_type* __s, size_type __sz);
|
1551
1629
|
void __init(size_type __n, value_type __c);
|
1552
1630
|
|
1553
1631
|
template <class _InputIterator>
|
@@ -1571,7 +1649,7 @@ private:
|
|
1571
1649
|
size_type __n_copy, size_type __n_del, size_type __n_add = 0);
|
1572
1650
|
void __grow_by_and_replace(size_type __old_cap, size_type __delta_cap, size_type __old_sz,
|
1573
1651
|
size_type __n_copy, size_type __n_del,
|
1574
|
-
size_type __n_add,
|
1652
|
+
size_type __n_add, const value_type* __p_new_stuff);
|
1575
1653
|
|
1576
1654
|
_LIBCPP_INLINE_VISIBILITY
|
1577
1655
|
void __erase_to_end(size_type __pos);
|
@@ -1728,7 +1806,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
|
|
1728
1806
|
|
1729
1807
|
template <class _CharT, class _Traits, class _Allocator>
|
1730
1808
|
void
|
1731
|
-
basic_string<_CharT, _Traits, _Allocator>::__init(
|
1809
|
+
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve)
|
1732
1810
|
{
|
1733
1811
|
if (__reserve > max_size())
|
1734
1812
|
this->__throw_length_error();
|
@@ -1746,13 +1824,13 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
|
|
1746
1824
|
__set_long_cap(__cap+1);
|
1747
1825
|
__set_long_size(__sz);
|
1748
1826
|
}
|
1749
|
-
traits_type::copy(__p, __s, __sz);
|
1827
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
|
1750
1828
|
traits_type::assign(__p[__sz], value_type());
|
1751
1829
|
}
|
1752
1830
|
|
1753
1831
|
template <class _CharT, class _Traits, class _Allocator>
|
1754
1832
|
void
|
1755
|
-
basic_string<_CharT, _Traits, _Allocator>::__init(
|
1833
|
+
basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz)
|
1756
1834
|
{
|
1757
1835
|
if (__sz > max_size())
|
1758
1836
|
this->__throw_length_error();
|
@@ -1770,13 +1848,13 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
|
|
1770
1848
|
__set_long_cap(__cap+1);
|
1771
1849
|
__set_long_size(__sz);
|
1772
1850
|
}
|
1773
|
-
traits_type::copy(__p, __s, __sz);
|
1851
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p), __s, __sz);
|
1774
1852
|
traits_type::assign(__p[__sz], value_type());
|
1775
1853
|
}
|
1776
1854
|
|
1777
1855
|
template <class _CharT, class _Traits, class _Allocator>
|
1778
1856
|
_LIBCPP_INLINE_VISIBILITY inline
|
1779
|
-
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
1857
|
+
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
|
1780
1858
|
{
|
1781
1859
|
#ifdef _LIBCPP_DEBUG
|
1782
1860
|
assert(__s != 0);
|
@@ -1786,7 +1864,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s)
|
|
1786
1864
|
|
1787
1865
|
template <class _CharT, class _Traits, class _Allocator>
|
1788
1866
|
_LIBCPP_INLINE_VISIBILITY inline
|
1789
|
-
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
1867
|
+
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a)
|
1790
1868
|
: __r_(__a)
|
1791
1869
|
{
|
1792
1870
|
#ifdef _LIBCPP_DEBUG
|
@@ -1797,7 +1875,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, const
|
|
1797
1875
|
|
1798
1876
|
template <class _CharT, class _Traits, class _Allocator>
|
1799
1877
|
_LIBCPP_INLINE_VISIBILITY inline
|
1800
|
-
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
1878
|
+
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n)
|
1801
1879
|
{
|
1802
1880
|
#ifdef _LIBCPP_DEBUG
|
1803
1881
|
assert(__s != 0);
|
@@ -1807,7 +1885,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_
|
|
1807
1885
|
|
1808
1886
|
template <class _CharT, class _Traits, class _Allocator>
|
1809
1887
|
_LIBCPP_INLINE_VISIBILITY inline
|
1810
|
-
basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
1888
|
+
basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a)
|
1811
1889
|
: __r_(__a)
|
1812
1890
|
{
|
1813
1891
|
#ifdef _LIBCPP_DEBUG
|
@@ -1823,7 +1901,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
|
1823
1901
|
if (!__str.__is_long())
|
1824
1902
|
__r_.first().__r = __str.__r_.first().__r;
|
1825
1903
|
else
|
1826
|
-
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
1904
|
+
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
1827
1905
|
}
|
1828
1906
|
|
1829
1907
|
template <class _CharT, class _Traits, class _Allocator>
|
@@ -1833,7 +1911,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
|
1833
1911
|
if (!__str.__is_long())
|
1834
1912
|
__r_.first().__r = __str.__r_.first().__r;
|
1835
1913
|
else
|
1836
|
-
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
1914
|
+
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
1837
1915
|
}
|
1838
1916
|
|
1839
1917
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
@@ -1858,7 +1936,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
|
|
1858
1936
|
if (__a == __str.__alloc() || !__str.__is_long())
|
1859
1937
|
__r_.first().__r = __str.__r_.first().__r;
|
1860
1938
|
else
|
1861
|
-
__init(__str.__get_long_pointer(), __str.__get_long_size());
|
1939
|
+
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
|
1862
1940
|
__str.__zero();
|
1863
1941
|
#ifdef _LIBCPP_DEBUG
|
1864
1942
|
__str.__invalidate_all_iterators();
|
@@ -1887,7 +1965,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
|
|
1887
1965
|
__set_long_cap(__cap+1);
|
1888
1966
|
__set_long_size(__n);
|
1889
1967
|
}
|
1890
|
-
traits_type::assign(__p, __n, __c);
|
1968
|
+
traits_type::assign(_VSTD::__to_raw_pointer(__p), __n, __c);
|
1891
1969
|
traits_type::assign(__p[__n], value_type());
|
1892
1970
|
}
|
1893
1971
|
|
@@ -2025,7 +2103,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
|
2025
2103
|
void
|
2026
2104
|
basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
2027
2105
|
(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,
|
2106
|
+
size_type __n_copy, size_type __n_del, size_type __n_add, const value_type* __p_new_stuff)
|
2029
2107
|
{
|
2030
2108
|
size_type __ms = max_size();
|
2031
2109
|
if (__delta_cap > __ms - __old_cap - 1)
|
@@ -2037,12 +2115,14 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
|
|
2037
2115
|
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
|
2038
2116
|
__invalidate_all_iterators();
|
2039
2117
|
if (__n_copy != 0)
|
2040
|
-
traits_type::copy(__p,
|
2118
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p),
|
2119
|
+
_VSTD::__to_raw_pointer(__old_p), __n_copy);
|
2041
2120
|
if (__n_add != 0)
|
2042
|
-
traits_type::copy(__p + __n_copy, __p_new_stuff, __n_add);
|
2121
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy, __p_new_stuff, __n_add);
|
2043
2122
|
size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
|
2044
2123
|
if (__sec_cp_sz != 0)
|
2045
|
-
traits_type::copy(__p + __n_copy + __n_add,
|
2124
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
|
2125
|
+
_VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del, __sec_cp_sz);
|
2046
2126
|
if (__old_cap+1 != __min_cap)
|
2047
2127
|
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
|
2048
2128
|
__set_long_pointer(__p);
|
@@ -2067,10 +2147,13 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
|
2067
2147
|
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
|
2068
2148
|
__invalidate_all_iterators();
|
2069
2149
|
if (__n_copy != 0)
|
2070
|
-
traits_type::copy(__p,
|
2150
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p),
|
2151
|
+
_VSTD::__to_raw_pointer(__old_p), __n_copy);
|
2071
2152
|
size_type __sec_cp_sz = __old_sz - __n_del - __n_copy;
|
2072
2153
|
if (__sec_cp_sz != 0)
|
2073
|
-
traits_type::copy(__p + __n_copy + __n_add,
|
2154
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__p) + __n_copy + __n_add,
|
2155
|
+
_VSTD::__to_raw_pointer(__old_p) + __n_copy + __n_del,
|
2156
|
+
__sec_cp_sz);
|
2074
2157
|
if (__old_cap+1 != __min_cap)
|
2075
2158
|
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
|
2076
2159
|
__set_long_pointer(__p);
|
@@ -2081,7 +2164,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
|
|
2081
2164
|
|
2082
2165
|
template <class _CharT, class _Traits, class _Allocator>
|
2083
2166
|
basic_string<_CharT, _Traits, _Allocator>&
|
2084
|
-
basic_string<_CharT, _Traits, _Allocator>::assign(
|
2167
|
+
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n)
|
2085
2168
|
{
|
2086
2169
|
#ifdef _LIBCPP_DEBUG
|
2087
2170
|
assert(__s != 0);
|
@@ -2089,7 +2172,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s, size_type _
|
|
2089
2172
|
size_type __cap = capacity();
|
2090
2173
|
if (__cap >= __n)
|
2091
2174
|
{
|
2092
|
-
|
2175
|
+
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
2093
2176
|
traits_type::move(__p, __s, __n);
|
2094
2177
|
traits_type::assign(__p[__n], value_type());
|
2095
2178
|
__set_size(__n);
|
@@ -2115,7 +2198,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(size_type __n, value_type __c)
|
|
2115
2198
|
}
|
2116
2199
|
else
|
2117
2200
|
__invalidate_iterators_past(__n);
|
2118
|
-
|
2201
|
+
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
2119
2202
|
traits_type::assign(__p, __n, __c);
|
2120
2203
|
traits_type::assign(__p[__n], value_type());
|
2121
2204
|
__set_size(__n);
|
@@ -2257,7 +2340,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, siz
|
|
2257
2340
|
|
2258
2341
|
template <class _CharT, class _Traits, class _Allocator>
|
2259
2342
|
basic_string<_CharT, _Traits, _Allocator>&
|
2260
|
-
basic_string<_CharT, _Traits, _Allocator>::assign(
|
2343
|
+
basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s)
|
2261
2344
|
{
|
2262
2345
|
#ifdef _LIBCPP_DEBUG
|
2263
2346
|
assert(__s != 0);
|
@@ -2269,7 +2352,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const_pointer __s)
|
|
2269
2352
|
|
2270
2353
|
template <class _CharT, class _Traits, class _Allocator>
|
2271
2354
|
basic_string<_CharT, _Traits, _Allocator>&
|
2272
|
-
basic_string<_CharT, _Traits, _Allocator>::append(
|
2355
|
+
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n)
|
2273
2356
|
{
|
2274
2357
|
#ifdef _LIBCPP_DEBUG
|
2275
2358
|
assert(__s != 0);
|
@@ -2280,7 +2363,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s, size_type _
|
|
2280
2363
|
{
|
2281
2364
|
if (__n)
|
2282
2365
|
{
|
2283
|
-
|
2366
|
+
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
2284
2367
|
traits_type::copy(__p + __sz, __s, __n);
|
2285
2368
|
__sz += __n;
|
2286
2369
|
__set_size(__sz);
|
@@ -2303,7 +2386,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(size_type __n, value_type __c)
|
|
2303
2386
|
if (__cap - __sz < __n)
|
2304
2387
|
__grow_by(__cap, __sz + __n - __cap, __sz, __sz, 0);
|
2305
2388
|
pointer __p = __get_pointer();
|
2306
|
-
traits_type::assign(__p + __sz, __n, __c);
|
2389
|
+
traits_type::assign(_VSTD::__to_raw_pointer(__p) + __sz, __n, __c);
|
2307
2390
|
__sz += __n;
|
2308
2391
|
__set_size(__sz);
|
2309
2392
|
traits_type::assign(__p[__sz], value_type());
|
@@ -2315,14 +2398,37 @@ template <class _CharT, class _Traits, class _Allocator>
|
|
2315
2398
|
void
|
2316
2399
|
basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
|
2317
2400
|
{
|
2318
|
-
|
2319
|
-
size_type
|
2401
|
+
bool __is_short = !__is_long();
|
2402
|
+
size_type __cap;
|
2403
|
+
size_type __sz;
|
2404
|
+
if (__is_short)
|
2405
|
+
{
|
2406
|
+
__cap = __min_cap - 1;
|
2407
|
+
__sz = __get_short_size();
|
2408
|
+
}
|
2409
|
+
else
|
2410
|
+
{
|
2411
|
+
__cap = __get_long_cap() - 1;
|
2412
|
+
__sz = __get_long_size();
|
2413
|
+
}
|
2320
2414
|
if (__sz == __cap)
|
2415
|
+
{
|
2321
2416
|
__grow_by(__cap, 1, __sz, __sz, 0);
|
2322
|
-
|
2417
|
+
__is_short = !__is_long();
|
2418
|
+
}
|
2419
|
+
pointer __p;
|
2420
|
+
if (__is_short)
|
2421
|
+
{
|
2422
|
+
__p = __get_short_pointer() + __sz;
|
2423
|
+
__set_short_size(__sz+1);
|
2424
|
+
}
|
2425
|
+
else
|
2426
|
+
{
|
2427
|
+
__p = __get_long_pointer() + __sz;
|
2428
|
+
__set_long_size(__sz+1);
|
2429
|
+
}
|
2323
2430
|
traits_type::assign(*__p, __c);
|
2324
2431
|
traits_type::assign(*++__p, value_type());
|
2325
|
-
__set_size(__sz+1);
|
2326
2432
|
}
|
2327
2433
|
|
2328
2434
|
template <class _CharT, class _Traits, class _Allocator>
|
@@ -2385,7 +2491,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, siz
|
|
2385
2491
|
|
2386
2492
|
template <class _CharT, class _Traits, class _Allocator>
|
2387
2493
|
basic_string<_CharT, _Traits, _Allocator>&
|
2388
|
-
basic_string<_CharT, _Traits, _Allocator>::append(
|
2494
|
+
basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s)
|
2389
2495
|
{
|
2390
2496
|
#ifdef _LIBCPP_DEBUG
|
2391
2497
|
assert(__s != 0);
|
@@ -2397,7 +2503,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const_pointer __s)
|
|
2397
2503
|
|
2398
2504
|
template <class _CharT, class _Traits, class _Allocator>
|
2399
2505
|
basic_string<_CharT, _Traits, _Allocator>&
|
2400
|
-
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos,
|
2506
|
+
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n)
|
2401
2507
|
{
|
2402
2508
|
#ifdef _LIBCPP_DEBUG
|
2403
2509
|
assert(__s != 0);
|
@@ -2410,7 +2516,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const_pointer
|
|
2410
2516
|
{
|
2411
2517
|
if (__n)
|
2412
2518
|
{
|
2413
|
-
|
2519
|
+
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
2414
2520
|
size_type __n_move = __sz - __pos;
|
2415
2521
|
if (__n_move != 0)
|
2416
2522
|
{
|
@@ -2439,10 +2545,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
|
|
2439
2545
|
if (__n)
|
2440
2546
|
{
|
2441
2547
|
size_type __cap = capacity();
|
2442
|
-
|
2548
|
+
value_type* __p;
|
2443
2549
|
if (__cap - __sz >= __n)
|
2444
2550
|
{
|
2445
|
-
__p = __get_pointer();
|
2551
|
+
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
2446
2552
|
size_type __n_move = __sz - __pos;
|
2447
2553
|
if (__n_move != 0)
|
2448
2554
|
traits_type::move(__p + __pos + __n, __p + __pos, __n_move);
|
@@ -2450,7 +2556,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n
|
|
2450
2556
|
else
|
2451
2557
|
{
|
2452
2558
|
__grow_by(__cap, __sz + __n - __cap, __sz, __pos, 0, __n);
|
2453
|
-
__p = __get_long_pointer();
|
2559
|
+
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
2454
2560
|
}
|
2455
2561
|
traits_type::assign(__p + __pos, __n, __c);
|
2456
2562
|
__sz += __n;
|
@@ -2494,10 +2600,10 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
|
|
2494
2600
|
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
2495
2601
|
if (__n)
|
2496
2602
|
{
|
2497
|
-
|
2603
|
+
value_type* __p;
|
2498
2604
|
if (__cap - __sz >= __n)
|
2499
2605
|
{
|
2500
|
-
__p = __get_pointer();
|
2606
|
+
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
2501
2607
|
size_type __n_move = __sz - __ip;
|
2502
2608
|
if (__n_move != 0)
|
2503
2609
|
traits_type::move(__p + __ip + __n, __p + __ip, __n_move);
|
@@ -2505,7 +2611,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
|
|
2505
2611
|
else
|
2506
2612
|
{
|
2507
2613
|
__grow_by(__cap, __sz + __n - __cap, __sz, __ip, 0, __n);
|
2508
|
-
__p = __get_long_pointer();
|
2614
|
+
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
2509
2615
|
}
|
2510
2616
|
__sz += __n;
|
2511
2617
|
__set_size(__sz);
|
@@ -2537,7 +2643,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const basic_
|
|
2537
2643
|
|
2538
2644
|
template <class _CharT, class _Traits, class _Allocator>
|
2539
2645
|
basic_string<_CharT, _Traits, _Allocator>&
|
2540
|
-
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos,
|
2646
|
+
basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s)
|
2541
2647
|
{
|
2542
2648
|
#ifdef _LIBCPP_DEBUG
|
2543
2649
|
assert(__s != 0);
|
@@ -2552,15 +2658,15 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, value_ty
|
|
2552
2658
|
size_type __ip = static_cast<size_type>(__pos - begin());
|
2553
2659
|
size_type __sz = size();
|
2554
2660
|
size_type __cap = capacity();
|
2555
|
-
|
2661
|
+
value_type* __p;
|
2556
2662
|
if (__cap == __sz)
|
2557
2663
|
{
|
2558
2664
|
__grow_by(__cap, 1, __sz, __ip, 0, 1);
|
2559
|
-
__p = __get_long_pointer();
|
2665
|
+
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
2560
2666
|
}
|
2561
2667
|
else
|
2562
2668
|
{
|
2563
|
-
__p = __get_pointer();
|
2669
|
+
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
2564
2670
|
size_type __n_move = __sz - __ip;
|
2565
2671
|
if (__n_move != 0)
|
2566
2672
|
traits_type::move(__p + __ip + 1, __p + __ip, __n_move);
|
@@ -2585,7 +2691,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ
|
|
2585
2691
|
|
2586
2692
|
template <class _CharT, class _Traits, class _Allocator>
|
2587
2693
|
basic_string<_CharT, _Traits, _Allocator>&
|
2588
|
-
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1,
|
2694
|
+
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
|
2589
2695
|
{
|
2590
2696
|
#ifdef _LIBCPP_DEBUG
|
2591
2697
|
assert(__s != 0);
|
@@ -2597,7 +2703,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
|
2597
2703
|
size_type __cap = capacity();
|
2598
2704
|
if (__cap - __sz + __n1 >= __n2)
|
2599
2705
|
{
|
2600
|
-
|
2706
|
+
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
2601
2707
|
if (__n1 != __n2)
|
2602
2708
|
{
|
2603
2709
|
size_type __n_move = __sz - __pos - __n1;
|
@@ -2646,10 +2752,10 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
|
2646
2752
|
this->__throw_out_of_range();
|
2647
2753
|
__n1 = _VSTD::min(__n1, __sz - __pos);
|
2648
2754
|
size_type __cap = capacity();
|
2649
|
-
|
2755
|
+
value_type* __p;
|
2650
2756
|
if (__cap - __sz + __n1 >= __n2)
|
2651
2757
|
{
|
2652
|
-
__p = __get_pointer();
|
2758
|
+
__p = _VSTD::__to_raw_pointer(__get_pointer());
|
2653
2759
|
if (__n1 != __n2)
|
2654
2760
|
{
|
2655
2761
|
size_type __n_move = __sz - __pos - __n1;
|
@@ -2660,7 +2766,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
|
|
2660
2766
|
else
|
2661
2767
|
{
|
2662
2768
|
__grow_by(__cap, __sz - __n1 + __n2 - __cap, __sz, __pos, __n1, __n2);
|
2663
|
-
__p = __get_long_pointer();
|
2769
|
+
__p = _VSTD::__to_raw_pointer(__get_long_pointer());
|
2664
2770
|
}
|
2665
2771
|
traits_type::assign(__p + __pos, __n2, __c);
|
2666
2772
|
__sz += __n2 - __n1;
|
@@ -2719,7 +2825,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type _
|
|
2719
2825
|
|
2720
2826
|
template <class _CharT, class _Traits, class _Allocator>
|
2721
2827
|
basic_string<_CharT, _Traits, _Allocator>&
|
2722
|
-
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1,
|
2828
|
+
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s)
|
2723
2829
|
{
|
2724
2830
|
#ifdef _LIBCPP_DEBUG
|
2725
2831
|
assert(__s != 0);
|
@@ -2739,7 +2845,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
|
|
2739
2845
|
template <class _CharT, class _Traits, class _Allocator>
|
2740
2846
|
_LIBCPP_INLINE_VISIBILITY inline
|
2741
2847
|
basic_string<_CharT, _Traits, _Allocator>&
|
2742
|
-
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
|
2848
|
+
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n)
|
2743
2849
|
{
|
2744
2850
|
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
|
2745
2851
|
}
|
@@ -2747,7 +2853,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_it
|
|
2747
2853
|
template <class _CharT, class _Traits, class _Allocator>
|
2748
2854
|
_LIBCPP_INLINE_VISIBILITY inline
|
2749
2855
|
basic_string<_CharT, _Traits, _Allocator>&
|
2750
|
-
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
|
2856
|
+
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const value_type* __s)
|
2751
2857
|
{
|
2752
2858
|
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
|
2753
2859
|
}
|
@@ -2771,7 +2877,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n)
|
|
2771
2877
|
this->__throw_out_of_range();
|
2772
2878
|
if (__n)
|
2773
2879
|
{
|
2774
|
-
|
2880
|
+
value_type* __p = _VSTD::__to_raw_pointer(__get_pointer());
|
2775
2881
|
__n = _VSTD::min(__n, __sz - __pos);
|
2776
2882
|
size_type __n_move = __sz - __pos - __n;
|
2777
2883
|
if (__n_move != 0)
|
@@ -2929,7 +3035,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
|
2929
3035
|
return;
|
2930
3036
|
}
|
2931
3037
|
#else // _LIBCPP_NO_EXCEPTIONS
|
2932
|
-
if (__new_data ==
|
3038
|
+
if (__new_data == nullptr)
|
2933
3039
|
return;
|
2934
3040
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
2935
3041
|
}
|
@@ -2937,7 +3043,8 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
|
2937
3043
|
__was_long = __is_long();
|
2938
3044
|
__p = __get_pointer();
|
2939
3045
|
}
|
2940
|
-
traits_type::copy(__new_data,
|
3046
|
+
traits_type::copy(_VSTD::__to_raw_pointer(__new_data),
|
3047
|
+
_VSTD::__to_raw_pointer(__p), size()+1);
|
2941
3048
|
if (__was_long)
|
2942
3049
|
__alloc_traits::deallocate(__alloc(), __p, __cap+1);
|
2943
3050
|
if (__now_long)
|
@@ -3038,7 +3145,7 @@ basic_string<_CharT, _Traits, _Allocator>::back() const
|
|
3038
3145
|
|
3039
3146
|
template <class _CharT, class _Traits, class _Allocator>
|
3040
3147
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3041
|
-
basic_string<_CharT, _Traits, _Allocator>::copy(
|
3148
|
+
basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const
|
3042
3149
|
{
|
3043
3150
|
size_type __sz = size();
|
3044
3151
|
if (__pos > __sz)
|
@@ -3084,7 +3191,7 @@ struct _LIBCPP_HIDDEN __traits_eq
|
|
3084
3191
|
|
3085
3192
|
template<class _CharT, class _Traits, class _Allocator>
|
3086
3193
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3087
|
-
basic_string<_CharT, _Traits, _Allocator>::find(
|
3194
|
+
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
3088
3195
|
size_type __pos,
|
3089
3196
|
size_type __n) const _NOEXCEPT
|
3090
3197
|
{
|
@@ -3096,8 +3203,8 @@ basic_string<_CharT, _Traits, _Allocator>::find(const_pointer __s,
|
|
3096
3203
|
return npos;
|
3097
3204
|
if (__n == 0)
|
3098
3205
|
return __pos;
|
3099
|
-
|
3100
|
-
|
3206
|
+
const value_type* __p = data();
|
3207
|
+
const value_type* __r = _VSTD::search(__p + __pos, __p + __sz, __s, __s + __n,
|
3101
3208
|
__traits_eq<traits_type>());
|
3102
3209
|
if (__r == __p + __sz)
|
3103
3210
|
return npos;
|
@@ -3116,7 +3223,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const basic_string& __str,
|
|
3116
3223
|
template<class _CharT, class _Traits, class _Allocator>
|
3117
3224
|
_LIBCPP_INLINE_VISIBILITY inline
|
3118
3225
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3119
|
-
basic_string<_CharT, _Traits, _Allocator>::find(
|
3226
|
+
basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
|
3120
3227
|
size_type __pos) const _NOEXCEPT
|
3121
3228
|
{
|
3122
3229
|
#ifdef _LIBCPP_DEBUG
|
@@ -3133,8 +3240,8 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
|
|
3133
3240
|
size_type __sz = size();
|
3134
3241
|
if (__pos >= __sz)
|
3135
3242
|
return npos;
|
3136
|
-
|
3137
|
-
|
3243
|
+
const value_type* __p = data();
|
3244
|
+
const value_type* __r = traits_type::find(__p + __pos, __sz - __pos, __c);
|
3138
3245
|
if (__r == 0)
|
3139
3246
|
return npos;
|
3140
3247
|
return static_cast<size_type>(__r - __p);
|
@@ -3144,7 +3251,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(value_type __c,
|
|
3144
3251
|
|
3145
3252
|
template<class _CharT, class _Traits, class _Allocator>
|
3146
3253
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3147
|
-
basic_string<_CharT, _Traits, _Allocator>::rfind(
|
3254
|
+
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
3148
3255
|
size_type __pos,
|
3149
3256
|
size_type __n) const _NOEXCEPT
|
3150
3257
|
{
|
@@ -3157,8 +3264,8 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const_pointer __s,
|
|
3157
3264
|
__pos += __n;
|
3158
3265
|
else
|
3159
3266
|
__pos = __sz;
|
3160
|
-
|
3161
|
-
|
3267
|
+
const value_type* __p = data();
|
3268
|
+
const value_type* __r = _VSTD::find_end(__p, __p + __pos, __s, __s + __n,
|
3162
3269
|
__traits_eq<traits_type>());
|
3163
3270
|
if (__n > 0 && __r == __p + __pos)
|
3164
3271
|
return npos;
|
@@ -3177,7 +3284,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const basic_string& __str,
|
|
3177
3284
|
template<class _CharT, class _Traits, class _Allocator>
|
3178
3285
|
_LIBCPP_INLINE_VISIBILITY inline
|
3179
3286
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3180
|
-
basic_string<_CharT, _Traits, _Allocator>::rfind(
|
3287
|
+
basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
|
3181
3288
|
size_type __pos) const _NOEXCEPT
|
3182
3289
|
{
|
3183
3290
|
#ifdef _LIBCPP_DEBUG
|
@@ -3198,8 +3305,8 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
|
|
3198
3305
|
++__pos;
|
3199
3306
|
else
|
3200
3307
|
__pos = __sz;
|
3201
|
-
|
3202
|
-
for (
|
3308
|
+
const value_type* __p = data();
|
3309
|
+
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
3203
3310
|
{
|
3204
3311
|
if (traits_type::eq(*--__ps, __c))
|
3205
3312
|
return static_cast<size_type>(__ps - __p);
|
@@ -3212,7 +3319,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(value_type __c,
|
|
3212
3319
|
|
3213
3320
|
template<class _CharT, class _Traits, class _Allocator>
|
3214
3321
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3215
|
-
basic_string<_CharT, _Traits, _Allocator>::find_first_of(
|
3322
|
+
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
3216
3323
|
size_type __pos,
|
3217
3324
|
size_type __n) const _NOEXCEPT
|
3218
3325
|
{
|
@@ -3222,8 +3329,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const_pointer __s,
|
|
3222
3329
|
size_type __sz = size();
|
3223
3330
|
if (__pos >= __sz || __n == 0)
|
3224
3331
|
return npos;
|
3225
|
-
|
3226
|
-
|
3332
|
+
const value_type* __p = data();
|
3333
|
+
const value_type* __r = _VSTD::find_first_of(__p + __pos, __p + __sz, __s,
|
3227
3334
|
__s + __n, __traits_eq<traits_type>());
|
3228
3335
|
if (__r == __p + __sz)
|
3229
3336
|
return npos;
|
@@ -3242,7 +3349,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const basic_string& __s
|
|
3242
3349
|
template<class _CharT, class _Traits, class _Allocator>
|
3243
3350
|
_LIBCPP_INLINE_VISIBILITY inline
|
3244
3351
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3245
|
-
basic_string<_CharT, _Traits, _Allocator>::find_first_of(
|
3352
|
+
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
|
3246
3353
|
size_type __pos) const _NOEXCEPT
|
3247
3354
|
{
|
3248
3355
|
#ifdef _LIBCPP_DEBUG
|
@@ -3264,7 +3371,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(value_type __c,
|
|
3264
3371
|
|
3265
3372
|
template<class _CharT, class _Traits, class _Allocator>
|
3266
3373
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3267
|
-
basic_string<_CharT, _Traits, _Allocator>::find_last_of(
|
3374
|
+
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
3268
3375
|
size_type __pos,
|
3269
3376
|
size_type __n) const _NOEXCEPT
|
3270
3377
|
{
|
@@ -3278,10 +3385,10 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const_pointer __s,
|
|
3278
3385
|
++__pos;
|
3279
3386
|
else
|
3280
3387
|
__pos = __sz;
|
3281
|
-
|
3282
|
-
for (
|
3388
|
+
const value_type* __p = data();
|
3389
|
+
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
3283
3390
|
{
|
3284
|
-
|
3391
|
+
const value_type* __r = traits_type::find(__s, __n, *--__ps);
|
3285
3392
|
if (__r)
|
3286
3393
|
return static_cast<size_type>(__ps - __p);
|
3287
3394
|
}
|
@@ -3301,7 +3408,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const basic_string& __st
|
|
3301
3408
|
template<class _CharT, class _Traits, class _Allocator>
|
3302
3409
|
_LIBCPP_INLINE_VISIBILITY inline
|
3303
3410
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3304
|
-
basic_string<_CharT, _Traits, _Allocator>::find_last_of(
|
3411
|
+
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
|
3305
3412
|
size_type __pos) const _NOEXCEPT
|
3306
3413
|
{
|
3307
3414
|
#ifdef _LIBCPP_DEBUG
|
@@ -3323,7 +3430,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(value_type __c,
|
|
3323
3430
|
|
3324
3431
|
template<class _CharT, class _Traits, class _Allocator>
|
3325
3432
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3326
|
-
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(
|
3433
|
+
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
|
3327
3434
|
size_type __pos,
|
3328
3435
|
size_type __n) const _NOEXCEPT
|
3329
3436
|
{
|
@@ -3333,9 +3440,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const_pointer __s,
|
|
3333
3440
|
size_type __sz = size();
|
3334
3441
|
if (__pos < __sz)
|
3335
3442
|
{
|
3336
|
-
|
3337
|
-
|
3338
|
-
for (
|
3443
|
+
const value_type* __p = data();
|
3444
|
+
const value_type* __pe = __p + __sz;
|
3445
|
+
for (const value_type* __ps = __p + __pos; __ps != __pe; ++__ps)
|
3339
3446
|
if (traits_type::find(__s, __n, *__ps) == 0)
|
3340
3447
|
return static_cast<size_type>(__ps - __p);
|
3341
3448
|
}
|
@@ -3354,7 +3461,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const basic_string&
|
|
3354
3461
|
template<class _CharT, class _Traits, class _Allocator>
|
3355
3462
|
_LIBCPP_INLINE_VISIBILITY inline
|
3356
3463
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3357
|
-
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(
|
3464
|
+
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s,
|
3358
3465
|
size_type __pos) const _NOEXCEPT
|
3359
3466
|
{
|
3360
3467
|
#ifdef _LIBCPP_DEBUG
|
@@ -3372,9 +3479,9 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
|
3372
3479
|
size_type __sz = size();
|
3373
3480
|
if (__pos < __sz)
|
3374
3481
|
{
|
3375
|
-
|
3376
|
-
|
3377
|
-
for (
|
3482
|
+
const value_type* __p = data();
|
3483
|
+
const value_type* __pe = __p + __sz;
|
3484
|
+
for (const value_type* __ps = __p + __pos; __ps != __pe; ++__ps)
|
3378
3485
|
if (!traits_type::eq(*__ps, __c))
|
3379
3486
|
return static_cast<size_type>(__ps - __p);
|
3380
3487
|
}
|
@@ -3385,7 +3492,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
|
3385
3492
|
|
3386
3493
|
template<class _CharT, class _Traits, class _Allocator>
|
3387
3494
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3388
|
-
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(
|
3495
|
+
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
|
3389
3496
|
size_type __pos,
|
3390
3497
|
size_type __n) const _NOEXCEPT
|
3391
3498
|
{
|
@@ -3397,8 +3504,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const_pointer __s,
|
|
3397
3504
|
++__pos;
|
3398
3505
|
else
|
3399
3506
|
__pos = __sz;
|
3400
|
-
|
3401
|
-
for (
|
3507
|
+
const value_type* __p = data();
|
3508
|
+
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
3402
3509
|
if (traits_type::find(__s, __n, *--__ps) == 0)
|
3403
3510
|
return static_cast<size_type>(__ps - __p);
|
3404
3511
|
return npos;
|
@@ -3416,7 +3523,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const basic_string&
|
|
3416
3523
|
template<class _CharT, class _Traits, class _Allocator>
|
3417
3524
|
_LIBCPP_INLINE_VISIBILITY inline
|
3418
3525
|
typename basic_string<_CharT, _Traits, _Allocator>::size_type
|
3419
|
-
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(
|
3526
|
+
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s,
|
3420
3527
|
size_type __pos) const _NOEXCEPT
|
3421
3528
|
{
|
3422
3529
|
#ifdef _LIBCPP_DEBUG
|
@@ -3436,8 +3543,8 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(value_type __c,
|
|
3436
3543
|
++__pos;
|
3437
3544
|
else
|
3438
3545
|
__pos = __sz;
|
3439
|
-
|
3440
|
-
for (
|
3546
|
+
const value_type* __p = data();
|
3547
|
+
for (const value_type* __ps = __p + __pos; __ps != __p;)
|
3441
3548
|
if (!traits_type::eq(*--__ps, __c))
|
3442
3549
|
return static_cast<size_type>(__ps - __p);
|
3443
3550
|
return npos;
|
@@ -3490,7 +3597,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
|
3490
3597
|
|
3491
3598
|
template <class _CharT, class _Traits, class _Allocator>
|
3492
3599
|
int
|
3493
|
-
basic_string<_CharT, _Traits, _Allocator>::compare(
|
3600
|
+
basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT
|
3494
3601
|
{
|
3495
3602
|
#ifdef _LIBCPP_DEBUG
|
3496
3603
|
assert(__s != 0);
|
@@ -3502,7 +3609,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
|
3502
3609
|
int
|
3503
3610
|
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
3504
3611
|
size_type __n1,
|
3505
|
-
|
3612
|
+
const value_type* __s) const
|
3506
3613
|
{
|
3507
3614
|
#ifdef _LIBCPP_DEBUG
|
3508
3615
|
assert(__s != 0);
|
@@ -3514,7 +3621,7 @@ template <class _CharT, class _Traits, class _Allocator>
|
|
3514
3621
|
int
|
3515
3622
|
basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
3516
3623
|
size_type __n1,
|
3517
|
-
|
3624
|
+
const value_type* __s,
|
3518
3625
|
size_type __n2) const
|
3519
3626
|
{
|
3520
3627
|
#ifdef _LIBCPP_DEBUG
|
@@ -3561,9 +3668,29 @@ bool
|
|
3561
3668
|
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
3562
3669
|
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
|
3563
3670
|
{
|
3564
|
-
|
3565
|
-
|
3566
|
-
|
3671
|
+
size_t __lhs_sz = __lhs.size();
|
3672
|
+
return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),
|
3673
|
+
__rhs.data(),
|
3674
|
+
__lhs_sz) == 0;
|
3675
|
+
}
|
3676
|
+
|
3677
|
+
template<class _Allocator>
|
3678
|
+
_LIBCPP_INLINE_VISIBILITY inline
|
3679
|
+
bool
|
3680
|
+
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
|
3681
|
+
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
|
3682
|
+
{
|
3683
|
+
size_t __lhs_sz = __lhs.size();
|
3684
|
+
if (__lhs_sz != __rhs.size())
|
3685
|
+
return false;
|
3686
|
+
const char* __lp = __lhs.data();
|
3687
|
+
const char* __rp = __rhs.data();
|
3688
|
+
if (__lhs.__is_long())
|
3689
|
+
return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
|
3690
|
+
for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
|
3691
|
+
if (*__lp != *__rp)
|
3692
|
+
return false;
|
3693
|
+
return true;
|
3567
3694
|
}
|
3568
3695
|
|
3569
3696
|
template<class _CharT, class _Traits, class _Allocator>
|
@@ -3975,6 +4102,42 @@ getline(basic_istream<_CharT, _Traits>&& __is,
|
|
3975
4102
|
|
3976
4103
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
3977
4104
|
|
4105
|
+
#if _LIBCPP_STD_VER > 11
|
4106
|
+
// Literal suffixes for basic_string [basic.string.literals]
|
4107
|
+
// inline // Deviation from N3690.
|
4108
|
+
// We believe the inline to be a defect and have submitted an LWG issue.
|
4109
|
+
// An LWG issue number has not yet been assigned.
|
4110
|
+
namespace literals
|
4111
|
+
{
|
4112
|
+
inline namespace string_literals
|
4113
|
+
{
|
4114
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
4115
|
+
basic_string<char> operator "" s( const char *__str, size_t __len )
|
4116
|
+
{
|
4117
|
+
return basic_string<char> (__str, __len);
|
4118
|
+
}
|
4119
|
+
|
4120
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
4121
|
+
basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len )
|
4122
|
+
{
|
4123
|
+
return basic_string<wchar_t> (__str, __len);
|
4124
|
+
}
|
4125
|
+
|
4126
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
4127
|
+
basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len )
|
4128
|
+
{
|
4129
|
+
return basic_string<char16_t> (__str, __len);
|
4130
|
+
}
|
4131
|
+
|
4132
|
+
inline _LIBCPP_INLINE_VISIBILITY
|
4133
|
+
basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len )
|
4134
|
+
{
|
4135
|
+
return basic_string<char32_t> (__str, __len);
|
4136
|
+
}
|
4137
|
+
}
|
4138
|
+
}
|
4139
|
+
#endif
|
4140
|
+
|
3978
4141
|
_LIBCPP_EXTERN_TEMPLATE(class basic_string<char>)
|
3979
4142
|
_LIBCPP_EXTERN_TEMPLATE(class basic_string<wchar_t>)
|
3980
4143
|
|