summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-29 15:11:47 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-29 15:11:47 +0000
commitd16566579cf1b541813986dc43183428789ad43c (patch)
tree2e6e2a78af9027099a85be853bab33b84d1386ea
parent191b2c615366546a9d15d615c0965b8bf1a1f368 (diff)
downloadgcc-d16566579cf1b541813986dc43183428789ad43c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166062 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog8
-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
4 files changed, 42 insertions, 30 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8b5b94aaec7..88918491263 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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)
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 3d76839f7f0..d8d2af5d64e 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 fd9c3589d69..a5f5e255825 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 efd61319152..08058c1a94f 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&