diff options
Diffstat (limited to 'contrib/libc++/include/map')
-rw-r--r-- | contrib/libc++/include/map | 103 |
1 files changed, 40 insertions, 63 deletions
diff --git a/contrib/libc++/include/map b/contrib/libc++/include/map index 9555aad..71f1869 100644 --- a/contrib/libc++/include/map +++ b/contrib/libc++/include/map @@ -453,9 +453,7 @@ swap(multimap<Key, T, Compare, Allocator>& x, _LIBCPP_BEGIN_NAMESPACE_STD -template <class _Key, class _CP, class _Compare, - bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value - > +template <class _Key, class _CP, class _Compare, bool _IsSmall> class __map_value_compare : private _Compare { @@ -482,8 +480,8 @@ public: void swap(__map_value_compare&__y) _NOEXCEPT_(__is_nothrow_swappable<_Compare>::value) { - using _VSTD::swap; - swap(static_cast<const _Compare&>(*this), static_cast<const _Compare&>(__y)); + using _VSTD::swap; + swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y)); } #if _LIBCPP_STD_VER > 11 @@ -584,7 +582,7 @@ public: __second_constructed(false) {} -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY __map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT : __na_(__x.__na_), @@ -593,7 +591,7 @@ public: { __x.__value_constructed = false; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY void operator()(pointer __p) _NOEXCEPT @@ -669,7 +667,7 @@ private: ~__value_type(); }; -#endif +#endif // _LIBCPP_CXX03_LANG template <class _Tp> struct __extract_key_value_types; @@ -923,7 +921,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY map(map&& __m) @@ -942,10 +940,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY map(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -973,7 +967,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit map(const allocator_type& __a) @@ -1084,6 +1078,10 @@ public: _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list<value_type> __il) + {insert(__il.begin(), __il.end());} #endif template <class _InputIterator> @@ -1094,14 +1092,6 @@ public: insert(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - #if _LIBCPP_STD_VER > 14 template <class... _Args> @@ -1196,7 +1186,7 @@ public: return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v)); } -#endif +#endif // _LIBCPP_STD_VER > 14 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} @@ -1309,7 +1299,6 @@ private: #ifndef _LIBCPP_CXX03_LANG - template <class _Key, class _Tp, class _Compare, class _Allocator> map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) : __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a)) @@ -1323,10 +1312,27 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a) } } -#endif // !_LIBCPP_CXX03_LANG +template <class _Key, class _Tp, class _Compare, class _Allocator> +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(__k), + _VSTD::forward_as_tuple()).first->__cc.second; +} +template <class _Key, class _Tp, class _Compare, class _Allocator> +_Tp& +map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) +{ + return __tree_.__emplace_unique_key_args(__k, + _VSTD::piecewise_construct, + _VSTD::forward_as_tuple(_VSTD::move(__k)), + _VSTD::forward_as_tuple()).first->__cc.second; +} -#ifdef _LIBCPP_CXX03_LANG +#else // _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Compare, class _Allocator> typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder @@ -1357,29 +1363,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) return __r->__value_.__cc.second; } -#else - -template <class _Key, class _Tp, class _Compare, class _Allocator> -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(__k), - _VSTD::forward_as_tuple()).first->__cc.second; -} - -template <class _Key, class _Tp, class _Compare, class _Allocator> -_Tp& -map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k) -{ - return __tree_.__emplace_unique_key_args(__k, - _VSTD::piecewise_construct, - _VSTD::forward_as_tuple(_VSTD::move(__k)), - _VSTD::forward_as_tuple()).first->__cc.second; -} - -#endif // !_LIBCPP_CXX03_LANG +#endif // _LIBCPP_CXX03_LANG template <class _Key, class _Tp, class _Compare, class _Allocator> _Tp& @@ -1595,7 +1579,7 @@ public: return *this; } -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES +#ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY multimap(multimap&& __m) @@ -1614,10 +1598,6 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare()) : __tree_(__vc(__comp)) @@ -1645,7 +1625,7 @@ public: return *this; } -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY explicit multimap(const allocator_type& __a) @@ -1738,6 +1718,11 @@ public: iterator insert(const_iterator __p, value_type&& __v) {return __tree_.__insert_multi(__p.__i_, _VSTD::move(__v));} + + _LIBCPP_INLINE_VISIBILITY + void insert(initializer_list<value_type> __il) + {insert(__il.begin(), __il.end());} + #endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -1755,14 +1740,6 @@ public: __tree_.__insert_multi(__e.__i_, *__f); } -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - - _LIBCPP_INLINE_VISIBILITY - void insert(initializer_list<value_type> __il) - {insert(__il.begin(), __il.end());} - -#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} _LIBCPP_INLINE_VISIBILITY |