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
@@ -381,7 +381,7 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
|
381
381
|
|
382
382
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
383
383
|
|
384
|
-
template <class _Key, class
|
384
|
+
template <class _Key, class _CP, class _Compare, bool = is_empty<_Compare>::value
|
385
385
|
#if __has_feature(is_final)
|
386
386
|
&& !__is_final(_Compare)
|
387
387
|
#endif
|
@@ -389,8 +389,6 @@ template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::valu
|
|
389
389
|
class __map_value_compare
|
390
390
|
: private _Compare
|
391
391
|
{
|
392
|
-
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
|
393
|
-
typedef pair<const _Key, _Tp> _CP;
|
394
392
|
public:
|
395
393
|
_LIBCPP_INLINE_VISIBILITY
|
396
394
|
__map_value_compare()
|
@@ -404,41 +402,20 @@ public:
|
|
404
402
|
const _Compare& key_comp() const _NOEXCEPT {return *this;}
|
405
403
|
_LIBCPP_INLINE_VISIBILITY
|
406
404
|
bool operator()(const _CP& __x, const _CP& __y) const
|
407
|
-
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
408
|
-
_LIBCPP_INLINE_VISIBILITY
|
409
|
-
bool operator()(const _CP& __x, const _Pp& __y) const
|
410
|
-
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
405
|
+
{return static_cast<const _Compare&>(*this)(__x.__cc.first, __y.__cc.first);}
|
411
406
|
_LIBCPP_INLINE_VISIBILITY
|
412
407
|
bool operator()(const _CP& __x, const _Key& __y) const
|
413
|
-
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
|
414
|
-
_LIBCPP_INLINE_VISIBILITY
|
415
|
-
bool operator()(const _Pp& __x, const _CP& __y) const
|
416
|
-
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
417
|
-
_LIBCPP_INLINE_VISIBILITY
|
418
|
-
bool operator()(const _Pp& __x, const _Pp& __y) const
|
419
|
-
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
420
|
-
_LIBCPP_INLINE_VISIBILITY
|
421
|
-
bool operator()(const _Pp& __x, const _Key& __y) const
|
422
|
-
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
|
408
|
+
{return static_cast<const _Compare&>(*this)(__x.__cc.first, __y);}
|
423
409
|
_LIBCPP_INLINE_VISIBILITY
|
424
410
|
bool operator()(const _Key& __x, const _CP& __y) const
|
425
|
-
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
|
426
|
-
_LIBCPP_INLINE_VISIBILITY
|
427
|
-
bool operator()(const _Key& __x, const _Pp& __y) const
|
428
|
-
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
|
429
|
-
_LIBCPP_INLINE_VISIBILITY
|
430
|
-
bool operator()(const _Key& __x, const _Key& __y) const
|
431
|
-
{return static_cast<const _Compare&>(*this)(__x, __y);}
|
411
|
+
{return static_cast<const _Compare&>(*this)(__x, __y.__cc.first);}
|
432
412
|
};
|
433
413
|
|
434
|
-
template <class _Key, class
|
435
|
-
class __map_value_compare<_Key,
|
414
|
+
template <class _Key, class _CP, class _Compare>
|
415
|
+
class __map_value_compare<_Key, _CP, _Compare, false>
|
436
416
|
{
|
437
417
|
_Compare comp;
|
438
418
|
|
439
|
-
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
|
440
|
-
typedef pair<const _Key, _Tp> _CP;
|
441
|
-
|
442
419
|
public:
|
443
420
|
_LIBCPP_INLINE_VISIBILITY
|
444
421
|
__map_value_compare()
|
@@ -453,31 +430,13 @@ public:
|
|
453
430
|
|
454
431
|
_LIBCPP_INLINE_VISIBILITY
|
455
432
|
bool operator()(const _CP& __x, const _CP& __y) const
|
456
|
-
{return comp(__x.first, __y.first);}
|
457
|
-
_LIBCPP_INLINE_VISIBILITY
|
458
|
-
bool operator()(const _CP& __x, const _Pp& __y) const
|
459
|
-
{return comp(__x.first, __y.first);}
|
433
|
+
{return comp(__x.__cc.first, __y.__cc.first);}
|
460
434
|
_LIBCPP_INLINE_VISIBILITY
|
461
435
|
bool operator()(const _CP& __x, const _Key& __y) const
|
462
|
-
{return comp(__x.first, __y);}
|
463
|
-
_LIBCPP_INLINE_VISIBILITY
|
464
|
-
bool operator()(const _Pp& __x, const _CP& __y) const
|
465
|
-
{return comp(__x.first, __y.first);}
|
466
|
-
_LIBCPP_INLINE_VISIBILITY
|
467
|
-
bool operator()(const _Pp& __x, const _Pp& __y) const
|
468
|
-
{return comp(__x.first, __y.first);}
|
469
|
-
_LIBCPP_INLINE_VISIBILITY
|
470
|
-
bool operator()(const _Pp& __x, const _Key& __y) const
|
471
|
-
{return comp(__x.first, __y);}
|
436
|
+
{return comp(__x.__cc.first, __y);}
|
472
437
|
_LIBCPP_INLINE_VISIBILITY
|
473
438
|
bool operator()(const _Key& __x, const _CP& __y) const
|
474
|
-
{return comp(__x, __y.first);}
|
475
|
-
_LIBCPP_INLINE_VISIBILITY
|
476
|
-
bool operator()(const _Key& __x, const _Pp& __y) const
|
477
|
-
{return comp(__x, __y.first);}
|
478
|
-
_LIBCPP_INLINE_VISIBILITY
|
479
|
-
bool operator()(const _Key& __x, const _Key& __y) const
|
480
|
-
{return comp(__x, __y);}
|
439
|
+
{return comp(__x, __y.__cc.first);}
|
481
440
|
};
|
482
441
|
|
483
442
|
template <class _Allocator>
|
@@ -489,8 +448,8 @@ class __map_node_destructor
|
|
489
448
|
public:
|
490
449
|
typedef typename __alloc_traits::pointer pointer;
|
491
450
|
private:
|
492
|
-
typedef typename value_type::first_type first_type;
|
493
|
-
typedef typename value_type::second_type second_type;
|
451
|
+
typedef typename value_type::value_type::first_type first_type;
|
452
|
+
typedef typename value_type::value_type::second_type second_type;
|
494
453
|
|
495
454
|
allocator_type& __na_;
|
496
455
|
|
@@ -522,9 +481,9 @@ public:
|
|
522
481
|
void operator()(pointer __p) _NOEXCEPT
|
523
482
|
{
|
524
483
|
if (__second_constructed)
|
525
|
-
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
|
484
|
+
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.second));
|
526
485
|
if (__first_constructed)
|
527
|
-
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
|
486
|
+
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.__cc.first));
|
528
487
|
if (__p)
|
529
488
|
__alloc_traits::deallocate(__na_, __p, 1);
|
530
489
|
}
|
@@ -542,8 +501,8 @@ class _LIBCPP_TYPE_VIS __map_iterator
|
|
542
501
|
_TreeIterator __i_;
|
543
502
|
|
544
503
|
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
545
|
-
typedef const typename _TreeIterator::value_type::first_type __key_type;
|
546
|
-
typedef typename _TreeIterator::value_type::second_type __mapped_type;
|
504
|
+
typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
|
505
|
+
typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
|
547
506
|
public:
|
548
507
|
typedef bidirectional_iterator_tag iterator_category;
|
549
508
|
typedef pair<__key_type, __mapped_type> value_type;
|
@@ -564,9 +523,9 @@ public:
|
|
564
523
|
__map_iterator(_TreeIterator __i) _NOEXCEPT : __i_(__i) {}
|
565
524
|
|
566
525
|
_LIBCPP_INLINE_VISIBILITY
|
567
|
-
reference operator*() const {return
|
526
|
+
reference operator*() const {return __i_->__cc;}
|
568
527
|
_LIBCPP_INLINE_VISIBILITY
|
569
|
-
pointer operator->() const {return (
|
528
|
+
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
|
570
529
|
|
571
530
|
_LIBCPP_INLINE_VISIBILITY
|
572
531
|
__map_iterator& operator++() {++__i_; return *this;}
|
@@ -607,8 +566,8 @@ class _LIBCPP_TYPE_VIS __map_const_iterator
|
|
607
566
|
_TreeIterator __i_;
|
608
567
|
|
609
568
|
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
|
610
|
-
typedef const typename _TreeIterator::value_type::first_type __key_type;
|
611
|
-
typedef typename _TreeIterator::value_type::second_type __mapped_type;
|
569
|
+
typedef const typename _TreeIterator::value_type::value_type::first_type __key_type;
|
570
|
+
typedef typename _TreeIterator::value_type::value_type::second_type __mapped_type;
|
612
571
|
public:
|
613
572
|
typedef bidirectional_iterator_tag iterator_category;
|
614
573
|
typedef pair<__key_type, __mapped_type> value_type;
|
@@ -634,9 +593,9 @@ public:
|
|
634
593
|
: __i_(__i.__i_) {}
|
635
594
|
|
636
595
|
_LIBCPP_INLINE_VISIBILITY
|
637
|
-
reference operator*() const {return
|
596
|
+
reference operator*() const {return __i_->__cc;}
|
638
597
|
_LIBCPP_INLINE_VISIBILITY
|
639
|
-
pointer operator->() const {return (
|
598
|
+
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__i_->__cc);}
|
640
599
|
|
641
600
|
_LIBCPP_INLINE_VISIBILITY
|
642
601
|
__map_const_iterator& operator++() {++__i_; return *this;}
|
@@ -679,6 +638,7 @@ public:
|
|
679
638
|
typedef _Key key_type;
|
680
639
|
typedef _Tp mapped_type;
|
681
640
|
typedef pair<const key_type, mapped_type> value_type;
|
641
|
+
typedef pair<key_type, mapped_type> __nc_value_type;
|
682
642
|
typedef _Compare key_compare;
|
683
643
|
typedef _Allocator allocator_type;
|
684
644
|
typedef value_type& reference;
|
@@ -699,8 +659,51 @@ public:
|
|
699
659
|
};
|
700
660
|
|
701
661
|
private:
|
702
|
-
|
703
|
-
|
662
|
+
|
663
|
+
#if __cplusplus >= 201103L
|
664
|
+
union __value_type
|
665
|
+
{
|
666
|
+
typedef typename map::value_type value_type;
|
667
|
+
typedef typename map::__nc_value_type __nc_value_type;
|
668
|
+
value_type __cc;
|
669
|
+
__nc_value_type __nc;
|
670
|
+
|
671
|
+
template <class ..._Args>
|
672
|
+
__value_type(_Args&& ...__args)
|
673
|
+
: __cc(std::forward<_Args>(__args)...) {}
|
674
|
+
|
675
|
+
__value_type(const __value_type& __v)
|
676
|
+
: __cc(std::move(__v.__cc)) {}
|
677
|
+
|
678
|
+
__value_type(__value_type&& __v)
|
679
|
+
: __nc(std::move(__v.__nc)) {}
|
680
|
+
|
681
|
+
__value_type& operator=(const __value_type& __v)
|
682
|
+
{__nc = __v.__cc; return *this;}
|
683
|
+
|
684
|
+
__value_type& operator=(__value_type&& __v)
|
685
|
+
{__nc = std::move(__v.__nc); return *this;}
|
686
|
+
|
687
|
+
~__value_type() {__cc.~value_type();}
|
688
|
+
};
|
689
|
+
#else
|
690
|
+
struct __value_type
|
691
|
+
{
|
692
|
+
typedef typename map::value_type value_type;
|
693
|
+
value_type __cc;
|
694
|
+
|
695
|
+
__value_type() {}
|
696
|
+
|
697
|
+
template <class _A0>
|
698
|
+
__value_type(const _A0& __a0)
|
699
|
+
: __cc(__a0) {}
|
700
|
+
|
701
|
+
template <class _A0, class _A1>
|
702
|
+
__value_type(const _A0& __a0, const _A1& __a1)
|
703
|
+
: __cc(__a0, __a1) {}
|
704
|
+
};
|
705
|
+
#endif
|
706
|
+
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
704
707
|
typedef typename allocator_traits<allocator_type>::template
|
705
708
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
706
709
|
rebind_alloc<__value_type>
|
@@ -764,7 +767,14 @@ public:
|
|
764
767
|
_LIBCPP_INLINE_VISIBILITY
|
765
768
|
map& operator=(const map& __m)
|
766
769
|
{
|
770
|
+
#if __cplusplus >= 201103L
|
767
771
|
__tree_ = __m.__tree_;
|
772
|
+
#else
|
773
|
+
__tree_.clear();
|
774
|
+
__tree_.value_comp() = __m.__tree_.value_comp();
|
775
|
+
__tree_.__copy_assign_alloc(__m.__tree_);
|
776
|
+
insert(__m.begin(), __m.end());
|
777
|
+
#endif
|
768
778
|
return *this;
|
769
779
|
}
|
770
780
|
|
@@ -986,32 +996,17 @@ private:
|
|
986
996
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
987
997
|
__node_holder __construct_node();
|
988
998
|
template <class _A0>
|
989
|
-
|
990
|
-
|
991
|
-
is_constructible<value_type, _A0>::value,
|
992
|
-
__node_holder
|
993
|
-
>::type
|
994
|
-
__construct_node(_A0&& __a0);
|
995
|
-
template <class _A0>
|
996
|
-
typename enable_if
|
997
|
-
<
|
998
|
-
is_constructible<key_type, _A0>::value,
|
999
|
-
__node_holder
|
1000
|
-
>::type
|
1001
|
-
__construct_node(_A0&& __a0);
|
999
|
+
__node_holder __construct_node(_A0&& __a0);
|
1000
|
+
__node_holder __construct_node_with_key(key_type&& __k);
|
1002
1001
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
1003
1002
|
template <class _A0, class _A1, class ..._Args>
|
1004
1003
|
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
|
1005
1004
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
1006
|
-
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1007
|
-
__node_holder __construct_node(const key_type& __k);
|
1008
1005
|
#endif
|
1006
|
+
__node_holder __construct_node_with_key(const key_type& __k);
|
1009
1007
|
|
1010
1008
|
__node_base_pointer&
|
1011
1009
|
__find_equal_key(__node_base_pointer& __parent, const key_type& __k);
|
1012
|
-
__node_base_pointer&
|
1013
|
-
__find_equal_key(const_iterator __hint,
|
1014
|
-
__node_base_pointer& __parent, const key_type& __k);
|
1015
1010
|
__node_base_const_pointer
|
1016
1011
|
__find_equal_key(__node_base_const_pointer& __parent, const key_type& __k) const;
|
1017
1012
|
};
|
@@ -1030,97 +1025,37 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_pointer& __pa
|
|
1030
1025
|
{
|
1031
1026
|
while (true)
|
1032
1027
|
{
|
1033
|
-
if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
|
1028
|
+
if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
|
1034
1029
|
{
|
1035
1030
|
if (__nd->__left_ != nullptr)
|
1036
1031
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
1037
1032
|
else
|
1038
1033
|
{
|
1039
|
-
__parent = __nd;
|
1034
|
+
__parent = static_cast<__node_base_pointer>(__nd);
|
1040
1035
|
return __parent->__left_;
|
1041
1036
|
}
|
1042
1037
|
}
|
1043
|
-
else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
|
1038
|
+
else if (__tree_.value_comp().key_comp()(__nd->__value_.__cc.first, __k))
|
1044
1039
|
{
|
1045
1040
|
if (__nd->__right_ != nullptr)
|
1046
1041
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
1047
1042
|
else
|
1048
1043
|
{
|
1049
|
-
__parent = __nd;
|
1044
|
+
__parent = static_cast<__node_base_pointer>(__nd);
|
1050
1045
|
return __parent->__right_;
|
1051
1046
|
}
|
1052
1047
|
}
|
1053
1048
|
else
|
1054
1049
|
{
|
1055
|
-
__parent = __nd;
|
1050
|
+
__parent = static_cast<__node_base_pointer>(__nd);
|
1056
1051
|
return __parent;
|
1057
1052
|
}
|
1058
1053
|
}
|
1059
1054
|
}
|
1060
|
-
__parent = __tree_.__end_node();
|
1055
|
+
__parent = static_cast<__node_base_pointer>(__tree_.__end_node());
|
1061
1056
|
return __parent->__left_;
|
1062
1057
|
}
|
1063
1058
|
|
1064
|
-
// Find place to insert if __k doesn't exist
|
1065
|
-
// First check prior to __hint.
|
1066
|
-
// Next check after __hint.
|
1067
|
-
// Next do O(log N) search.
|
1068
|
-
// Set __parent to parent of null leaf
|
1069
|
-
// Return reference to null leaf
|
1070
|
-
// If __k exists, set parent to node of __k and return reference to node of __k
|
1071
|
-
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1072
|
-
typename map<_Key, _Tp, _Compare, _Allocator>::__node_base_pointer&
|
1073
|
-
map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
|
1074
|
-
__node_base_pointer& __parent,
|
1075
|
-
const key_type& __k)
|
1076
|
-
{
|
1077
|
-
if (__hint == end() || __tree_.value_comp().key_comp()(__k, __hint->first)) // check before
|
1078
|
-
{
|
1079
|
-
// __k < *__hint
|
1080
|
-
const_iterator __prior = __hint;
|
1081
|
-
if (__prior == begin() || __tree_.value_comp().key_comp()((--__prior)->first, __k))
|
1082
|
-
{
|
1083
|
-
// *prev(__hint) < __k < *__hint
|
1084
|
-
if (__hint.__ptr_->__left_ == nullptr)
|
1085
|
-
{
|
1086
|
-
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
1087
|
-
return __parent->__left_;
|
1088
|
-
}
|
1089
|
-
else
|
1090
|
-
{
|
1091
|
-
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
|
1092
|
-
return __parent->__right_;
|
1093
|
-
}
|
1094
|
-
}
|
1095
|
-
// __k <= *prev(__hint)
|
1096
|
-
return __find_equal_key(__parent, __k);
|
1097
|
-
}
|
1098
|
-
else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
|
1099
|
-
{
|
1100
|
-
// *__hint < __k
|
1101
|
-
const_iterator __next = _VSTD::next(__hint);
|
1102
|
-
if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
|
1103
|
-
{
|
1104
|
-
// *__hint < __k < *next(__hint)
|
1105
|
-
if (__hint.__ptr_->__right_ == nullptr)
|
1106
|
-
{
|
1107
|
-
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
1108
|
-
return __parent->__right_;
|
1109
|
-
}
|
1110
|
-
else
|
1111
|
-
{
|
1112
|
-
__parent = const_cast<__node_pointer&>(__next.__ptr_);
|
1113
|
-
return __parent->__left_;
|
1114
|
-
}
|
1115
|
-
}
|
1116
|
-
// *next(__hint) <= __k
|
1117
|
-
return __find_equal_key(__parent, __k);
|
1118
|
-
}
|
1119
|
-
// else __k == *__hint
|
1120
|
-
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
|
1121
|
-
return __parent;
|
1122
|
-
}
|
1123
|
-
|
1124
1059
|
// Find __k
|
1125
1060
|
// Set __parent to parent of null leaf and
|
1126
1061
|
// return reference to null leaf iv __k does not exist.
|
@@ -1135,34 +1070,34 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_const_pointer
|
|
1135
1070
|
{
|
1136
1071
|
while (true)
|
1137
1072
|
{
|
1138
|
-
if (__tree_.value_comp().key_comp()(__k, __nd->__value_.first))
|
1073
|
+
if (__tree_.value_comp().key_comp()(__k, __nd->__value_.__cc.first))
|
1139
1074
|
{
|
1140
1075
|
if (__nd->__left_ != nullptr)
|
1141
1076
|
__nd = static_cast<__node_pointer>(__nd->__left_);
|
1142
1077
|
else
|
1143
1078
|
{
|
1144
|
-
__parent = __nd;
|
1079
|
+
__parent = static_cast<__node_base_pointer>(__nd);
|
1145
1080
|
return const_cast<const __node_base_const_pointer&>(__parent->__left_);
|
1146
1081
|
}
|
1147
1082
|
}
|
1148
|
-
else if (__tree_.value_comp().key_comp()(__nd->__value_.first, __k))
|
1083
|
+
else if (__tree_.value_comp().key_comp()(__nd->__value_.__cc.first, __k))
|
1149
1084
|
{
|
1150
1085
|
if (__nd->__right_ != nullptr)
|
1151
1086
|
__nd = static_cast<__node_pointer>(__nd->__right_);
|
1152
1087
|
else
|
1153
1088
|
{
|
1154
|
-
__parent = __nd;
|
1089
|
+
__parent = static_cast<__node_base_pointer>(__nd);
|
1155
1090
|
return const_cast<const __node_base_const_pointer&>(__parent->__right_);
|
1156
1091
|
}
|
1157
1092
|
}
|
1158
1093
|
else
|
1159
1094
|
{
|
1160
|
-
__parent = __nd;
|
1095
|
+
__parent = static_cast<__node_base_pointer>(__nd);
|
1161
1096
|
return __parent;
|
1162
1097
|
}
|
1163
1098
|
}
|
1164
1099
|
}
|
1165
|
-
__parent = __tree_.__end_node();
|
1100
|
+
__parent = static_cast<__node_base_pointer>(__tree_.__end_node());
|
1166
1101
|
return const_cast<const __node_base_const_pointer&>(__parent->__left_);
|
1167
1102
|
}
|
1168
1103
|
|
@@ -1187,20 +1122,16 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
|
1187
1122
|
{
|
1188
1123
|
__node_allocator& __na = __tree_.__node_alloc();
|
1189
1124
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
1190
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
|
1125
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first));
|
1191
1126
|
__h.get_deleter().__first_constructed = true;
|
1192
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
1127
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
|
1193
1128
|
__h.get_deleter().__second_constructed = true;
|
1194
1129
|
return __h;
|
1195
1130
|
}
|
1196
1131
|
|
1197
1132
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1198
1133
|
template <class _A0>
|
1199
|
-
typename
|
1200
|
-
<
|
1201
|
-
is_constructible<pair<const _Key, _Tp>, _A0>::value,
|
1202
|
-
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1203
|
-
>::type
|
1134
|
+
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1204
1135
|
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
1205
1136
|
{
|
1206
1137
|
__node_allocator& __na = __tree_.__node_alloc();
|
@@ -1212,21 +1143,16 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
|
1212
1143
|
}
|
1213
1144
|
|
1214
1145
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1215
|
-
|
1216
|
-
|
1217
|
-
<
|
1218
|
-
is_constructible<_Key, _A0>::value,
|
1219
|
-
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1220
|
-
>::type
|
1221
|
-
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
1146
|
+
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1147
|
+
map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(key_type&& __k)
|
1222
1148
|
{
|
1223
1149
|
__node_allocator& __na = __tree_.__node_alloc();
|
1224
1150
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
1225
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::
|
1151
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), _VSTD::move(__k));
|
1226
1152
|
__h.get_deleter().__first_constructed = true;
|
1227
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
1153
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
|
1228
1154
|
__h.get_deleter().__second_constructed = true;
|
1229
|
-
return __h;
|
1155
|
+
return _VSTD::move(__h);
|
1230
1156
|
}
|
1231
1157
|
|
1232
1158
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
@@ -1248,23 +1174,21 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _
|
|
1248
1174
|
|
1249
1175
|
#endif // _LIBCPP_HAS_NO_VARIADICS
|
1250
1176
|
|
1251
|
-
#
|
1177
|
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1252
1178
|
|
1253
1179
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1254
1180
|
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1255
|
-
map<_Key, _Tp, _Compare, _Allocator>::
|
1181
|
+
map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type& __k)
|
1256
1182
|
{
|
1257
1183
|
__node_allocator& __na = __tree_.__node_alloc();
|
1258
1184
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
1259
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
1185
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
|
1260
1186
|
__h.get_deleter().__first_constructed = true;
|
1261
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
1187
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
|
1262
1188
|
__h.get_deleter().__second_constructed = true;
|
1263
1189
|
return _VSTD::move(__h);
|
1264
1190
|
}
|
1265
1191
|
|
1266
|
-
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1267
|
-
|
1268
1192
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1269
1193
|
_Tp&
|
1270
1194
|
map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
|
@@ -1274,11 +1198,11 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
|
|
1274
1198
|
__node_pointer __r = static_cast<__node_pointer>(__child);
|
1275
1199
|
if (__child == nullptr)
|
1276
1200
|
{
|
1277
|
-
__node_holder __h =
|
1278
|
-
__tree_.__insert_node_at(__parent, __child, __h.get());
|
1201
|
+
__node_holder __h = __construct_node_with_key(__k);
|
1202
|
+
__tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
1279
1203
|
__r = __h.release();
|
1280
1204
|
}
|
1281
|
-
return __r->__value_.second;
|
1205
|
+
return __r->__value_.__cc.second;
|
1282
1206
|
}
|
1283
1207
|
|
1284
1208
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
@@ -1292,11 +1216,11 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
|
|
1292
1216
|
__node_pointer __r = static_cast<__node_pointer>(__child);
|
1293
1217
|
if (__child == nullptr)
|
1294
1218
|
{
|
1295
|
-
__node_holder __h =
|
1296
|
-
__tree_.__insert_node_at(__parent, __child, __h.get());
|
1219
|
+
__node_holder __h = __construct_node_with_key(_VSTD::move(__k));
|
1220
|
+
__tree_.__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
1297
1221
|
__r = __h.release();
|
1298
1222
|
}
|
1299
|
-
return __r->__value_.second;
|
1223
|
+
return __r->__value_.__cc.second;
|
1300
1224
|
}
|
1301
1225
|
|
1302
1226
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
@@ -1311,7 +1235,7 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k)
|
|
1311
1235
|
if (__child == nullptr)
|
1312
1236
|
throw out_of_range("map::at: key not found");
|
1313
1237
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
1314
|
-
return static_cast<__node_pointer>(__child)->__value_.second;
|
1238
|
+
return static_cast<__node_pointer>(__child)->__value_.__cc.second;
|
1315
1239
|
}
|
1316
1240
|
|
1317
1241
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
@@ -1324,7 +1248,7 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
|
|
1324
1248
|
if (__child == nullptr)
|
1325
1249
|
throw out_of_range("map::at: key not found");
|
1326
1250
|
#endif // _LIBCPP_NO_EXCEPTIONS
|
1327
|
-
return static_cast<__node_const_pointer>(__child)->__value_.second;
|
1251
|
+
return static_cast<__node_const_pointer>(__child)->__value_.__cc.second;
|
1328
1252
|
}
|
1329
1253
|
|
1330
1254
|
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
@@ -1429,6 +1353,7 @@ public:
|
|
1429
1353
|
typedef _Key key_type;
|
1430
1354
|
typedef _Tp mapped_type;
|
1431
1355
|
typedef pair<const key_type, mapped_type> value_type;
|
1356
|
+
typedef pair<key_type, mapped_type> __nc_value_type;
|
1432
1357
|
typedef _Compare key_compare;
|
1433
1358
|
typedef _Allocator allocator_type;
|
1434
1359
|
typedef value_type& reference;
|
@@ -1450,8 +1375,50 @@ public:
|
|
1450
1375
|
};
|
1451
1376
|
|
1452
1377
|
private:
|
1453
|
-
|
1454
|
-
|
1378
|
+
#if __cplusplus >= 201103L
|
1379
|
+
union __value_type
|
1380
|
+
{
|
1381
|
+
typedef typename multimap::value_type value_type;
|
1382
|
+
typedef typename multimap::__nc_value_type __nc_value_type;
|
1383
|
+
value_type __cc;
|
1384
|
+
__nc_value_type __nc;
|
1385
|
+
|
1386
|
+
template <class ..._Args>
|
1387
|
+
__value_type(_Args&& ...__args)
|
1388
|
+
: __cc(std::forward<_Args>(__args)...) {}
|
1389
|
+
|
1390
|
+
__value_type(const __value_type& __v)
|
1391
|
+
: __cc(std::move(__v.__cc)) {}
|
1392
|
+
|
1393
|
+
__value_type(__value_type&& __v)
|
1394
|
+
: __nc(std::move(__v.__nc)) {}
|
1395
|
+
|
1396
|
+
__value_type& operator=(const __value_type& __v)
|
1397
|
+
{__nc = __v.__cc; return *this;}
|
1398
|
+
|
1399
|
+
__value_type& operator=(__value_type&& __v)
|
1400
|
+
{__nc = std::move(__v.__nc); return *this;}
|
1401
|
+
|
1402
|
+
~__value_type() {__cc.~value_type();}
|
1403
|
+
};
|
1404
|
+
#else
|
1405
|
+
struct __value_type
|
1406
|
+
{
|
1407
|
+
typedef typename multimap::value_type value_type;
|
1408
|
+
value_type __cc;
|
1409
|
+
|
1410
|
+
__value_type() {}
|
1411
|
+
|
1412
|
+
template <class _A0>
|
1413
|
+
__value_type(const _A0& __a0)
|
1414
|
+
: __cc(__a0) {}
|
1415
|
+
|
1416
|
+
template <class _A0, class _A1>
|
1417
|
+
__value_type(const _A0& __a0, const _A1& __a1)
|
1418
|
+
: __cc(__a0, __a1) {}
|
1419
|
+
};
|
1420
|
+
#endif
|
1421
|
+
typedef __map_value_compare<key_type, __value_type, key_compare> __vc;
|
1455
1422
|
typedef typename allocator_traits<allocator_type>::template
|
1456
1423
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
1457
1424
|
rebind_alloc<__value_type>
|
@@ -1516,7 +1483,14 @@ public:
|
|
1516
1483
|
_LIBCPP_INLINE_VISIBILITY
|
1517
1484
|
multimap& operator=(const multimap& __m)
|
1518
1485
|
{
|
1486
|
+
#if __cplusplus >= 201103L
|
1519
1487
|
__tree_ = __m.__tree_;
|
1488
|
+
#else
|
1489
|
+
__tree_.clear();
|
1490
|
+
__tree_.value_comp() = __m.__tree_.value_comp();
|
1491
|
+
__tree_.__copy_assign_alloc(__m.__tree_);
|
1492
|
+
insert(__m.begin(), __m.end());
|
1493
|
+
#endif
|
1520
1494
|
return *this;
|
1521
1495
|
}
|
1522
1496
|
|
@@ -1725,18 +1699,7 @@ private:
|
|
1725
1699
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
1726
1700
|
__node_holder __construct_node();
|
1727
1701
|
template <class _A0>
|
1728
|
-
|
1729
|
-
<
|
1730
|
-
is_constructible<value_type, _A0>::value,
|
1731
|
-
__node_holder
|
1732
|
-
>::type
|
1733
|
-
__construct_node(_A0&& __a0);
|
1734
|
-
template <class _A0>
|
1735
|
-
typename enable_if
|
1736
|
-
<
|
1737
|
-
is_constructible<key_type, _A0>::value,
|
1738
|
-
__node_holder
|
1739
|
-
>::type
|
1702
|
+
__node_holder
|
1740
1703
|
__construct_node(_A0&& __a0);
|
1741
1704
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
1742
1705
|
template <class _A0, class _A1, class ..._Args>
|
@@ -1766,20 +1729,16 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
|
1766
1729
|
{
|
1767
1730
|
__node_allocator& __na = __tree_.__node_alloc();
|
1768
1731
|
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
1769
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
|
1732
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first));
|
1770
1733
|
__h.get_deleter().__first_constructed = true;
|
1771
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
1734
|
+
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
|
1772
1735
|
__h.get_deleter().__second_constructed = true;
|
1773
1736
|
return __h;
|
1774
1737
|
}
|
1775
1738
|
|
1776
1739
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1777
1740
|
template <class _A0>
|
1778
|
-
typename
|
1779
|
-
<
|
1780
|
-
is_constructible<pair<const _Key, _Tp>, _A0>::value,
|
1781
|
-
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1782
|
-
>::type
|
1741
|
+
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1783
1742
|
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
1784
1743
|
{
|
1785
1744
|
__node_allocator& __na = __tree_.__node_alloc();
|
@@ -1790,24 +1749,6 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
|
1790
1749
|
return __h;
|
1791
1750
|
}
|
1792
1751
|
|
1793
|
-
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
1794
|
-
template <class _A0>
|
1795
|
-
typename enable_if
|
1796
|
-
<
|
1797
|
-
is_constructible<_Key, _A0>::value,
|
1798
|
-
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
1799
|
-
>::type
|
1800
|
-
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
1801
|
-
{
|
1802
|
-
__node_allocator& __na = __tree_.__node_alloc();
|
1803
|
-
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
1804
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
1805
|
-
__h.get_deleter().__first_constructed = true;
|
1806
|
-
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
1807
|
-
__h.get_deleter().__second_constructed = true;
|
1808
|
-
return __h;
|
1809
|
-
}
|
1810
|
-
|
1811
1752
|
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
1812
1753
|
|
1813
1754
|
template <class _Key, class _Tp, class _Compare, class _Allocator>
|