diff options
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r-- | libstdc++-v3/include/bits/hashtable.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/hashtable_policy.h | 53 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_function.h | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/unordered_map.h | 14 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/unordered_set.h | 4 |
5 files changed, 44 insertions, 39 deletions
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 9a79549..f5bc358 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -203,8 +203,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using __key_extract = typename std::conditional< __constant_iterators::value, - std::_Identity<value_type>, - std::_Select1st<value_type>>::type; + __detail::_Identity, + __detail::_Select1st>::type; using __hashtable_base = __detail:: _Hashtable_base<_Key, _Value, _ExtractKey, diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index a42d3d3..708ef98 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -86,6 +86,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION noexcept(declval<const _Hash&>()(declval<const _Key&>()))> { }; + struct _Identity + { + template<typename _Tp> + _Tp&& + operator()(_Tp&& __x) const + { return std::forward<_Tp>(__x); } + }; + + struct _Select1st + { + template<typename _Tp> + auto + operator()(_Tp&& __x) const + -> decltype(std::get<0>(std::forward<_Tp>(__x))) + { return std::get<0>(std::forward<_Tp>(__x)); } + }; + // Auxiliary types used for all instantiations of _Hashtable nodes // and iterators. @@ -497,27 +514,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> - struct _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, false> { - using mapped_type = typename _Pair::second_type; + using mapped_type = typename std::tuple_element<1, _Pair>::type; }; /// Partial specialization, __unique_keys set to true. template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> - struct _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> { private: using __hashtable_base = __detail::_Hashtable_base<_Key, _Pair, - std::_Select1st<_Pair>, + _Select1st, _Equal, _H1, _H2, _Hash, _Traits>; using __hashtable = _Hashtable<_Key, _Pair, _Alloc, - std::_Select1st<_Pair>, _Equal, + _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>; using __hash_code = typename __hashtable_base::__hash_code; @@ -526,7 +543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: using key_type = typename __hashtable_base::key_type; using iterator = typename __hashtable_base::iterator; - using mapped_type = typename _Pair::second_type; + using mapped_type = typename std::tuple_element<1, _Pair>::type; mapped_type& operator[](const key_type& __k); @@ -546,10 +563,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> - typename _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> ::mapped_type& - _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: operator[](const key_type& __k) { @@ -567,10 +584,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> - typename _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> ::mapped_type& - _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: operator[](key_type&& __k) { @@ -589,10 +606,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> - typename _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + typename _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true> ::mapped_type& - _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: at(const key_type& __k) { @@ -609,11 +626,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Key, typename _Pair, typename _Alloc, typename _Equal, typename _H1, typename _H2, typename _Hash, typename _RehashPolicy, typename _Traits> - const typename _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, - _Equal, - _H1, _H2, _Hash, _RehashPolicy, _Traits, true> - ::mapped_type& - _Map_base<_Key, _Pair, _Alloc, std::_Select1st<_Pair>, _Equal, + const typename _Map_base<_Key, _Pair, _Alloc, _Select1st, + _Equal, _H1, _H2, _Hash, _RehashPolicy, + _Traits, true>::mapped_type& + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: at(const key_type& __k) const { @@ -1492,8 +1508,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION iterator>::type; using __iconv_type = typename std::conditional<__unique_keys::value, - std::_Select1st<__ireturn_type>, - std::_Identity<__ireturn_type> + _Select1st, _Identity >::type; private: using _EqualEBO = _Hashtable_ebo_helper<0, _Equal>; diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h index 33d5e70..42f5c17 100644 --- a/libstdc++-v3/include/bits/stl_function.h +++ b/libstdc++-v3/include/bits/stl_function.h @@ -473,11 +473,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp> struct _Identity -#ifndef __GXX_EXPERIMENTAL_CXX0X__ - // unary_function itself is deprecated in C++11 and deriving from - // it can even be a nuisance (see PR 52942). : public unary_function<_Tp,_Tp> -#endif { _Tp& operator()(_Tp& __x) const @@ -490,9 +486,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Pair> struct _Select1st -#ifndef __GXX_EXPERIMENTAL_CXX0X__ : public unary_function<_Pair, typename _Pair::first_type> -#endif { typename _Pair::first_type& operator()(_Pair& __x) const @@ -517,9 +511,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Pair> struct _Select2nd -#ifndef __GXX_EXPERIMENTAL_CXX0X__ : public unary_function<_Pair, typename _Pair::second_type> -#endif { typename _Pair::second_type& operator()(_Pair& __x) const diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index bd3e46d..27703b6 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -45,12 +45,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >, typename _Tr = __umap_traits<__cache_default<_Key, _Hash>::value>> using __umap_hashtable = _Hashtable<_Key, std::pair<const _Key, _Tp>, - _Alloc, - std::_Select1st<std::pair<const _Key, _Tp>>, - _Pred, _Hash, - __detail::_Mod_range_hashing, - __detail::_Default_ranged_hash, - __detail::_Prime_rehash_policy, _Tr>; + _Alloc, __detail::_Select1st, + _Pred, _Hash, + __detail::_Mod_range_hashing, + __detail::_Default_ranged_hash, + __detail::_Prime_rehash_policy, _Tr>; /// Base types for unordered_multimap. template<bool _Cache> @@ -63,8 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >, typename _Tr = __ummap_traits<__cache_default<_Key, _Hash>::value>> using __ummap_hashtable = _Hashtable<_Key, std::pair<const _Key, _Tp>, - _Alloc, - std::_Select1st<std::pair<const _Key, _Tp>>, + _Alloc, __detail::_Select1st, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 32b606a..8817947 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typename _Alloc = std::allocator<_Value>, typename _Tr = __uset_traits<__cache_default<_Value, _Hash>::value>> using __uset_hashtable = _Hashtable<_Value, _Value, _Alloc, - std::_Identity<_Value>, _Pred, _Hash, + __detail::_Identity, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, __detail::_Prime_rehash_policy, _Tr>; @@ -59,7 +59,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typename _Alloc = std::allocator<_Value>, typename _Tr = __umset_traits<__cache_default<_Value, _Hash>::value>> using __umset_hashtable = _Hashtable<_Value, _Value, _Alloc, - std::_Identity<_Value>, + __detail::_Identity, _Pred, _Hash, __detail::_Mod_range_hashing, __detail::_Default_ranged_hash, |