stl_function.h (_Select1st<>::operator()): Add templatized overloads.
2010-10-29 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_function.h (_Select1st<>::operator()): Add templatized overloads. * include/bits/hashtable_policy.h (_Select1st): Remove; revert everything to std::_Select1st. * include/bits/unordered_map.h: Likewise. From-SVN: r166062
This commit is contained in:
parent
f87bd04b07
commit
777a1e28c3
4 changed files with 42 additions and 30 deletions
|
@ -1,3 +1,11 @@
|
|||
2010-10-29 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* include/bits/stl_function.h (_Select1st<>::operator()): Add
|
||||
templatized overloads.
|
||||
* include/bits/hashtable_policy.h (_Select1st): Remove; revert
|
||||
everything to std::_Select1st.
|
||||
* include/bits/unordered_map.h: Likewise.
|
||||
|
||||
2010-10-28 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR libstdc++/44436 (partial)
|
||||
|
|
|
@ -56,14 +56,6 @@ namespace __detail
|
|||
return __distance_fw(__first, __last, _Tag());
|
||||
}
|
||||
|
||||
struct _Select1st
|
||||
{
|
||||
template<typename _Pair>
|
||||
const typename _Pair::first_type&
|
||||
operator()(const _Pair& __pair) const
|
||||
{ return __pair.first; }
|
||||
};
|
||||
|
||||
// Auxiliary types used for all instantiations of _Hashtable: nodes
|
||||
// and iterators.
|
||||
|
||||
|
@ -511,13 +503,13 @@ namespace __detail
|
|||
struct _Map_base { };
|
||||
|
||||
template<typename _Key, typename _Pair, typename _Hashtable>
|
||||
struct _Map_base<_Key, _Pair, _Select1st, false, _Hashtable>
|
||||
struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, false, _Hashtable>
|
||||
{
|
||||
typedef typename _Pair::second_type mapped_type;
|
||||
};
|
||||
|
||||
template<typename _Key, typename _Pair, typename _Hashtable>
|
||||
struct _Map_base<_Key, _Pair, _Select1st, true, _Hashtable>
|
||||
struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>
|
||||
{
|
||||
typedef typename _Pair::second_type mapped_type;
|
||||
|
||||
|
@ -537,9 +529,9 @@ namespace __detail
|
|||
};
|
||||
|
||||
template<typename _Key, typename _Pair, typename _Hashtable>
|
||||
typename _Map_base<_Key, _Pair, _Select1st,
|
||||
typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
|
||||
true, _Hashtable>::mapped_type&
|
||||
_Map_base<_Key, _Pair, _Select1st, true, _Hashtable>::
|
||||
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
|
||||
operator[](const _Key& __k)
|
||||
{
|
||||
_Hashtable* __h = static_cast<_Hashtable*>(this);
|
||||
|
@ -556,9 +548,9 @@ namespace __detail
|
|||
}
|
||||
|
||||
template<typename _Key, typename _Pair, typename _Hashtable>
|
||||
typename _Map_base<_Key, _Pair, _Select1st,
|
||||
typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
|
||||
true, _Hashtable>::mapped_type&
|
||||
_Map_base<_Key, _Pair, _Select1st, true, _Hashtable>::
|
||||
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
|
||||
operator[](_Key&& __k)
|
||||
{
|
||||
_Hashtable* __h = static_cast<_Hashtable*>(this);
|
||||
|
@ -576,10 +568,10 @@ namespace __detail
|
|||
}
|
||||
|
||||
template<typename _Key, typename _Pair, typename _Hashtable>
|
||||
typename _Map_base<_Key, _Pair, _Select1st,
|
||||
typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
|
||||
true, _Hashtable>::mapped_type&
|
||||
_Map_base<_Key, _Pair, _Select1st, true, _Hashtable>::
|
||||
at(const _Key& __k)
|
||||
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
|
||||
at(const _Key& __k)
|
||||
{
|
||||
_Hashtable* __h = static_cast<_Hashtable*>(this);
|
||||
typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
|
||||
|
@ -594,10 +586,10 @@ namespace __detail
|
|||
}
|
||||
|
||||
template<typename _Key, typename _Pair, typename _Hashtable>
|
||||
const typename _Map_base<_Key, _Pair, _Select1st,
|
||||
const typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
|
||||
true, _Hashtable>::mapped_type&
|
||||
_Map_base<_Key, _Pair, _Select1st, true, _Hashtable>::
|
||||
at(const _Key& __k) const
|
||||
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
|
||||
at(const _Key& __k) const
|
||||
{
|
||||
const _Hashtable* __h = static_cast<const _Hashtable*>(this);
|
||||
typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
|
||||
|
|
|
@ -487,6 +487,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
const typename _Pair::first_type&
|
||||
operator()(const _Pair& __x) const
|
||||
{ return __x.first; }
|
||||
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
template<typename _Pair2>
|
||||
typename _Pair2::first_type&
|
||||
operator()(_Pair2& __x) const
|
||||
{ return __x.first; }
|
||||
|
||||
template<typename _Pair2>
|
||||
const typename _Pair2::first_type&
|
||||
operator()(const _Pair2& __x) const
|
||||
{ return __x.first; }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename _Pair>
|
||||
|
|
|
@ -41,14 +41,14 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
bool __cache_hash_code = false>
|
||||
class __unordered_map
|
||||
: public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
|
||||
__detail::_Select1st, _Pred,
|
||||
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
|
||||
_Hash, __detail::_Mod_range_hashing,
|
||||
__detail::_Default_ranged_hash,
|
||||
__detail::_Prime_rehash_policy,
|
||||
__cache_hash_code, false, true>
|
||||
{
|
||||
typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,
|
||||
__detail::_Select1st, _Pred,
|
||||
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
|
||||
_Hash, __detail::_Mod_range_hashing,
|
||||
__detail::_Default_ranged_hash,
|
||||
__detail::_Prime_rehash_policy,
|
||||
|
@ -69,7 +69,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__n, __hf, __detail::_Mod_range_hashing(),
|
||||
__detail::_Default_ranged_hash(),
|
||||
__eql, __detail::_Select1st(), __a)
|
||||
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
|
||||
{ }
|
||||
|
||||
template<typename _InputIterator>
|
||||
|
@ -80,7 +80,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
|
||||
__detail::_Default_ranged_hash(),
|
||||
__eql, __detail::_Select1st(), __a)
|
||||
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
|
||||
{ }
|
||||
|
||||
__unordered_map(initializer_list<value_type> __l,
|
||||
|
@ -91,7 +91,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
: _Base(__l.begin(), __l.end(), __n, __hf,
|
||||
__detail::_Mod_range_hashing(),
|
||||
__detail::_Default_ranged_hash(),
|
||||
__eql, __detail::_Select1st(), __a)
|
||||
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
|
||||
{ }
|
||||
|
||||
__unordered_map&
|
||||
|
@ -111,7 +111,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
class __unordered_multimap
|
||||
: public _Hashtable<_Key, std::pair<const _Key, _Tp>,
|
||||
_Alloc,
|
||||
__detail::_Select1st, _Pred,
|
||||
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
|
||||
_Hash, __detail::_Mod_range_hashing,
|
||||
__detail::_Default_ranged_hash,
|
||||
__detail::_Prime_rehash_policy,
|
||||
|
@ -119,7 +119,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
{
|
||||
typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,
|
||||
_Alloc,
|
||||
__detail::_Select1st, _Pred,
|
||||
std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,
|
||||
_Hash, __detail::_Mod_range_hashing,
|
||||
__detail::_Default_ranged_hash,
|
||||
__detail::_Prime_rehash_policy,
|
||||
|
@ -140,7 +140,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__n, __hf, __detail::_Mod_range_hashing(),
|
||||
__detail::_Default_ranged_hash(),
|
||||
__eql, __detail::_Select1st(), __a)
|
||||
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
|
||||
{ }
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
const allocator_type& __a = allocator_type())
|
||||
: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),
|
||||
__detail::_Default_ranged_hash(),
|
||||
__eql, __detail::_Select1st(), __a)
|
||||
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
|
||||
{ }
|
||||
|
||||
__unordered_multimap(initializer_list<value_type> __l,
|
||||
|
@ -163,7 +163,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
|
|||
: _Base(__l.begin(), __l.end(), __n, __hf,
|
||||
__detail::_Mod_range_hashing(),
|
||||
__detail::_Default_ranged_hash(),
|
||||
__eql, __detail::_Select1st(), __a)
|
||||
__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)
|
||||
{ }
|
||||
|
||||
__unordered_multimap&
|
||||
|
|
Loading…
Add table
Reference in a new issue