diff options
Diffstat (limited to 'contrib/llvm-project/libcxx/include/unordered_map')
-rw-r--r-- | contrib/llvm-project/libcxx/include/unordered_map | 356 |
1 files changed, 224 insertions, 132 deletions
diff --git a/contrib/llvm-project/libcxx/include/unordered_map b/contrib/llvm-project/libcxx/include/unordered_map index ea0382de7d40..53ddb95663d1 100644 --- a/contrib/llvm-project/libcxx/include/unordered_map +++ b/contrib/llvm-project/libcxx/include/unordered_map @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-------------------------- unordered_map -----------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -216,6 +216,47 @@ public: void reserve(size_type n); }; +template<class InputIterator, + class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>, + class Allocator = allocator<iter_to_alloc_t<InputIterator>>> +unordered_map(InputIterator, InputIterator, typename see below::size_type = see below, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + -> unordered_map<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred, + Allocator>; // C++17 + +template<class Key, class T, class Hash = hash<Key>, + class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>> +unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type = see below, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + -> unordered_map<Key, T, Hash, Pred, Allocator>; // C++17 + +template<class InputIterator, class Allocator> +unordered_map(InputIterator, InputIterator, typename see below::size_type, Allocator) + -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, + hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 + +template<class InputIterator, class Allocator> +unordered_map(InputIterator, InputIterator, Allocator) + -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, + hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 + +template<class InputIterator, class Hash, class Allocator> +unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator) + -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash, + equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 + +template<class Key, class T, typename Allocator> +unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator) + -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 + +template<class Key, class T, typename Allocator> +unordered_map(initializer_list<pair<const Key, T>>, Allocator) + -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 + +template<class Key, class T, class Hash, class Allocator> +unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash, Allocator) + -> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>; // C++17 + template <class Key, class T, class Hash, class Pred, class Alloc> void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x, unordered_map<Key, T, Hash, Pred, Alloc>& y) @@ -404,6 +445,48 @@ public: void reserve(size_type n); }; +template<class InputIterator, + class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>, + class Allocator = allocator<iter_to_alloc_t<InputIterator>>> +unordered_multimap(InputIterator, InputIterator, typename see below::size_type = see below, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + -> unordered_multimap<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred, + Allocator>; // C++17 + +template<class Key, class T, class Hash = hash<Key>, + class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>> +unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type = see below, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + -> unordered_multimap<Key, T, Hash, Pred, Allocator>; // C++17 + +template<class InputIterator, class Allocator> +unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Allocator) + -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, + hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 + +template<class InputIterator, class Allocator> +unordered_multimap(InputIterator, InputIterator, Allocator) + -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, + hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 + +template<class InputIterator, class Hash, class Allocator> +unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator) + -> unordered_multimap<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash, + equal_to<iter_key_t<InputIterator>>, Allocator>; // C++17 + +template<class Key, class T, typename Allocator> +unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator) + -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 + +template<class Key, class T, typename Allocator> +unordered_multimap(initializer_list<pair<const Key, T>>, Allocator) + -> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>; // C++17 + +template<class Key, class T, class Hash, class Allocator> +unordered_multimap(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash, + Allocator) + -> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>; // C++17 + template <class Key, class T, class Hash, class Pred, class Alloc> void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x, unordered_multimap<Key, T, Hash, Pred, Alloc>& y) @@ -434,6 +517,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc> #include <__config> #include <__debug> #include <__functional/is_transparent.h> +#include <__iterator/iterator_traits.h> #include <__hash_table> #include <__node_handle> #include <__utility/forward.h> @@ -473,12 +557,13 @@ public: size_t operator()(const _Key& __x) const {return static_cast<const _Hash&>(*this)(__x);} #if _LIBCPP_STD_VER > 17 - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY size_t operator()(const _K2& __x) const {return static_cast<const _Hash&>(*this)(__x);} #endif - void swap(__unordered_map_hasher&__y) + _LIBCPP_INLINE_VISIBILITY + void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { using _VSTD::swap; @@ -508,12 +593,13 @@ public: size_t operator()(const _Key& __x) const {return __hash_(__x);} #if _LIBCPP_STD_VER > 17 - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY size_t operator()(const _K2& __x) const {return __hash_(__x);} #endif - void swap(__unordered_map_hasher&__y) + _LIBCPP_INLINE_VISIBILITY + void swap(__unordered_map_hasher& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hash>::value) { using _VSTD::swap; @@ -557,24 +643,25 @@ public: bool operator()(const _Key& __x, const _Cp& __y) const {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} #if _LIBCPP_STD_VER > 17 - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _K2& __y) const {return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);} - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _K2& __x, const _Cp& __y) const {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _K2& __y) const {return static_cast<const _Pred&>(*this)(__x, __y);} - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _K2& __x, const _Key& __y) const {return static_cast<const _Pred&>(*this)(__x, __y);} #endif - void swap(__unordered_map_equal&__y) + _LIBCPP_INLINE_VISIBILITY + void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { using _VSTD::swap; @@ -607,24 +694,25 @@ public: bool operator()(const _Key& __x, const _Cp& __y) const {return __pred_(__x, __y.__get_value().first);} #if _LIBCPP_STD_VER > 17 - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _K2& __y) const {return __pred_(__x.__get_value().first, __y);} - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _K2& __x, const _Cp& __y) const {return __pred_(__x, __y.__get_value().first);} - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _K2& __y) const {return __pred_(__x, __y);} - template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>> + template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _K2& __x, const _Key& __y) const {return __pred_(__x, __y);} #endif - void swap(__unordered_map_equal&__y) + _LIBCPP_INLINE_VISIBILITY + void swap(__unordered_map_equal& __y) _NOEXCEPT_(__is_nothrow_swappable<_Pred>::value) { using _VSTD::swap; @@ -1052,7 +1140,7 @@ public: #ifndef _LIBCPP_CXX03_LANG __table_ = __u.__table_; #else - if (this != &__u) { + if (this != _VSTD::addressof(__u)) { __table_.clear(); __table_.hash_function() = __u.__table_.hash_function(); __table_.key_eq() = __u.__table_.key_eq(); @@ -1355,51 +1443,48 @@ public: iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} - - #if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> - find(const _K2& __k) {return __table_.find(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> - find(const _K2& __k) const {return __table_.find(__k);} - #endif // _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER > 17 + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + iterator find(const _K2& __k) {return __table_.find(__k);} + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + const_iterator find(const _K2& __k) const {return __table_.find(__k);} +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} - #if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> - count(const _K2& __k) const {return __table_.__count_unique(__k);} - #endif // _LIBCPP_STD_VER > 17 - #if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} +#if _LIBCPP_STD_VER > 17 + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} +#endif // _LIBCPP_STD_VER > 17 + +#if _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY + bool contains(const key_type& __k) const {return find(__k) != end();} + + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + bool contains(const _K2& __k) const {return find(__k) != end();} +#endif // _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> - contains(const _K2& __k) const {return find(__k) != end();} - #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const key_type& __k) {return __table_.__equal_range_unique(__k);} _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} - #if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> - equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> - equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} - #endif // _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER > 17 + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + pair<iterator, iterator> equal_range(const _K2& __k) + {return __table_.__equal_range_unique(__k);} + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + pair<const_iterator, const_iterator> equal_range(const _K2& __k) const + {return __table_.__equal_range_unique(__k);} +#endif // _LIBCPP_STD_VER > 17 mapped_type& operator[](const key_type& __k); #ifndef _LIBCPP_CXX03_LANG @@ -1447,13 +1532,13 @@ public: #if _LIBCPP_DEBUG_LEVEL == 2 bool __dereferenceable(const const_iterator* __i) const - {return __table_.__dereferenceable(&__i->__i_);} + {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));} bool __decrementable(const const_iterator* __i) const - {return __table_.__decrementable(&__i->__i_);} + {return __table_.__decrementable(_VSTD::addressof(__i->__i_));} bool __addable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(&__i->__i_, __n);} + {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(&__i->__i_, __n);} + {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} #endif // _LIBCPP_DEBUG_LEVEL == 2 @@ -1464,15 +1549,16 @@ private: #endif }; -#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +#if _LIBCPP_STD_VER >= 17 template<class _InputIterator, class _Hash = hash<__iter_key_type<_InputIterator>>, class _Pred = equal_to<__iter_key_type<_InputIterator>>, class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<!__is_allocator<_Pred>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<!__is_allocator<_Pred>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>; @@ -1480,52 +1566,55 @@ unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocat template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>, class _Pred = equal_to<remove_const_t<_Key>>, class _Allocator = allocator<pair<const _Key, _Tp>>, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<!__is_allocator<_Pred>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<!__is_allocator<_Pred>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0, _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>; template<class _InputIterator, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; template<class _InputIterator, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(_InputIterator, _InputIterator, _Allocator) -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; template<class _InputIterator, class _Hash, class _Allocator, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) -> unordered_map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; template<class _Key, class _Tp, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator) -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>; template<class _Key, class _Tp, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator) -> unordered_map<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>; template<class _Key, class _Tp, class _Hash, class _Allocator, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_map(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) -> unordered_map<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>; @@ -1987,7 +2076,7 @@ public: #ifndef _LIBCPP_CXX03_LANG __table_ = __u.__table_; #else - if (this != &__u) { + if (this != _VSTD::addressof(__u)) { __table_.clear(); __table_.hash_function() = __u.__table_.hash_function(); __table_.key_eq() = __u.__table_.key_eq(); @@ -2167,49 +2256,48 @@ public: iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} - #if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator> - find(const _K2& __k) {return __table_.find(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator> - find(const _K2& __k) const {return __table_.find(__k);} - #endif // _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER > 17 + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + iterator find(const _K2& __k) {return __table_.find(__k);} + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + const_iterator find(const _K2& __k) const {return __table_.find(__k);} +#endif // _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} - #if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type> - count(const _K2& __k) const {return __table_.__count_multi(__k);} - #endif // _LIBCPP_STD_VER > 17 - #if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - bool contains(const key_type& __k) const {return find(__k) != end();} +#if _LIBCPP_STD_VER > 17 + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} +#endif // _LIBCPP_STD_VER > 17 + +#if _LIBCPP_STD_VER > 17 + _LIBCPP_INLINE_VISIBILITY + bool contains(const key_type& __k) const {return find(__k) != end();} + + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + bool contains(const _K2& __k) const {return find(__k) != end();} +#endif // _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool> - contains(const _K2& __k) const {return find(__k) != end();} - #endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const key_type& __k) {return __table_.__equal_range_multi(__k);} _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} - #if _LIBCPP_STD_VER > 17 - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>> - equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);} - template <typename _K2> - _LIBCPP_INLINE_VISIBILITY - _EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>> - equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} - #endif // _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER > 17 + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + pair<iterator, iterator> equal_range(const _K2& __k) + {return __table_.__equal_range_multi(__k);} + template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> + _LIBCPP_INLINE_VISIBILITY + pair<const_iterator, const_iterator> equal_range(const _K2& __k) const + {return __table_.__equal_range_multi(__k);} +#endif // _LIBCPP_STD_VER > 17 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} @@ -2250,28 +2338,29 @@ public: #if _LIBCPP_DEBUG_LEVEL == 2 bool __dereferenceable(const const_iterator* __i) const - {return __table_.__dereferenceable(&__i->__i_);} + {return __table_.__dereferenceable(_VSTD::addressof(__i->__i_));} bool __decrementable(const const_iterator* __i) const - {return __table_.__decrementable(&__i->__i_);} + {return __table_.__decrementable(_VSTD::addressof(__i->__i_));} bool __addable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(&__i->__i_, __n);} + {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const - {return __table_.__addable(&__i->__i_, __n);} + {return __table_.__addable(_VSTD::addressof(__i->__i_), __n);} #endif // _LIBCPP_DEBUG_LEVEL == 2 }; -#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +#if _LIBCPP_STD_VER >= 17 template<class _InputIterator, class _Hash = hash<__iter_key_type<_InputIterator>>, class _Pred = equal_to<__iter_key_type<_InputIterator>>, class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<!__is_allocator<_Pred>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<!__is_allocator<_Pred>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type = 0, _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, _Pred, _Allocator>; @@ -2279,52 +2368,55 @@ unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Al template<class _Key, class _Tp, class _Hash = hash<remove_const_t<_Key>>, class _Pred = equal_to<remove_const_t<_Key>>, class _Allocator = allocator<pair<const _Key, _Tp>>, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<!__is_allocator<_Pred>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<!__is_allocator<_Pred>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type = 0, _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, _Pred, _Allocator>; template<class _InputIterator, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Allocator) -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; template<class _InputIterator, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(_InputIterator, _InputIterator, _Allocator) -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, hash<__iter_key_type<_InputIterator>>, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; template<class _InputIterator, class _Hash, class _Allocator, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>, + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(_InputIterator, _InputIterator, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) -> unordered_multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Hash, equal_to<__iter_key_type<_InputIterator>>, _Allocator>; template<class _Key, class _Tp, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Allocator) -> unordered_multimap<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>; template<class _Key, class _Tp, class _Allocator, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator) -> unordered_multimap<remove_const_t<_Key>, _Tp, hash<remove_const_t<_Key>>, equal_to<remove_const_t<_Key>>, _Allocator>; template<class _Key, class _Tp, class _Hash, class _Allocator, - class = _EnableIf<!__is_allocator<_Hash>::value>, - class = _EnableIf<!is_integral<_Hash>::value>, - class = _EnableIf<__is_allocator<_Allocator>::value>> + class = enable_if_t<!__is_allocator<_Hash>::value>, + class = enable_if_t<!is_integral<_Hash>::value>, + class = enable_if_t<__is_allocator<_Allocator>::value>> unordered_multimap(initializer_list<pair<_Key, _Tp>>, typename allocator_traits<_Allocator>::size_type, _Hash, _Allocator) -> unordered_multimap<remove_const_t<_Key>, _Tp, _Hash, equal_to<remove_const_t<_Key>>, _Allocator>; |