aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-10-29 15:11:47 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-10-29 15:11:47 +0000
commit777a1e28c38171e6f07625f98c3932c165994d8c (patch)
tree2e6e2a78af9027099a85be853bab33b84d1386ea /libstdc++-v3/include
parentf87bd04b07ddd4c86f6da5c82585bd6de2ce1e73 (diff)
downloadgcc-777a1e28c38171e6f07625f98c3932c165994d8c.zip
gcc-777a1e28c38171e6f07625f98c3932c165994d8c.tar.gz
gcc-777a1e28c38171e6f07625f98c3932c165994d8c.tar.bz2
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
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h32
-rw-r--r--libstdc++-v3/include/bits/stl_function.h12
-rw-r--r--libstdc++-v3/include/bits/unordered_map.h20
3 files changed, 34 insertions, 30 deletions
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 3d76839..d8d2af5 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -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);
diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index fd9c358..a5f5e25 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -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>
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index efd6131..08058c1 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -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&