From: Paolo Carlini Date: Wed, 22 Sep 2010 17:50:36 +0000 (+0000) Subject: functional_hash.h (__hash_base): Add. X-Git-Tag: releases/gcc-4.6.0~4180 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d64ee190c8875dec5f15c0287a425a1e62041a9;p=thirdparty%2Fgcc.git functional_hash.h (__hash_base): Add. 2010-09-22 Paolo Carlini * include/bits/functional_hash.h (__hash_base): Add. (hash): Derive from __hash_base instead. * include/debug/bitset (hash): Likewise. * include/debug/vector (hash): Likewise. * include/std/system_error (hash): Likewise. * include/std/thread (hash): Likewise. * include/std/bitset (hash): Likewise. * include/profile/bitset (hash): Likewise. * include/profile/vector (hash): Likewise. * include/bits/basic_string.h (hash): Likewise. * include/bits/stl_bvector.h (hash): Likewise. * include/std/typeindex (hash): Do not derive from unary_function, add result_type and argument_type typedefs; trim includes. From-SVN: r164528 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 58171dce3dd9..8f5dc71af88c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2010-09-22 Paolo Carlini + + * include/bits/functional_hash.h (__hash_base): Add. + (hash): Derive from __hash_base instead. + * include/debug/bitset (hash): Likewise. + * include/debug/vector (hash): Likewise. + * include/std/system_error (hash): Likewise. + * include/std/thread (hash): Likewise. + * include/std/bitset (hash): Likewise. + * include/profile/bitset (hash): Likewise. + * include/profile/vector (hash): Likewise. + * include/bits/basic_string.h (hash): Likewise. + * include/bits/stl_bvector.h (hash): Likewise. + * include/std/typeindex (hash): Do not derive from unary_function, + add result_type and argument_type typedefs; trim includes. + 2010-09-22 Paolo Carlini * include/std/typeindex: New. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 2fb671721ab3..308285bec86d 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -2925,7 +2925,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for string. template<> struct hash - : public std::unary_function + : public __hash_base { size_t operator()(const string& __s) const @@ -2936,7 +2936,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for wstring. template<> struct hash - : public std::unary_function + : public __hash_base { size_t operator()(const wstring& __s) const @@ -2950,7 +2950,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for u16string. template<> struct hash - : public std::unary_function + : public __hash_base { size_t operator()(const u16string& __s) const @@ -2961,7 +2961,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for u32string. template<> struct hash - : public std::unary_function + : public __hash_base { size_t operator()(const u32string& __s) const diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h index 363968788924..a132cce76896 100644 --- a/libstdc++-v3/include/bits/functional_hash.h +++ b/libstdc++-v3/include/bits/functional_hash.h @@ -33,7 +33,6 @@ #pragma GCC system_header #include -#include namespace std { @@ -45,9 +44,16 @@ namespace std * @{ */ + template + struct __hash_base + { + typedef _Result result_type; + typedef _Arg argument_type; + }; + /// Primary class template hash. template - struct hash : public std::unary_function<_Tp, size_t> + struct hash : public __hash_base { size_t operator()(_Tp __val) const; @@ -55,7 +61,7 @@ namespace std /// Partial specializations for pointer types. template - struct hash<_Tp*> : public std::unary_function<_Tp*, size_t> + struct hash<_Tp*> : public __hash_base { size_t operator()(_Tp* __p) const diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index c489b447ca15..74c2e85fd70a 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -1038,7 +1038,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for vector. template struct hash<_GLIBCXX_STD_D::vector> - : public std::unary_function<_GLIBCXX_STD_D::vector, size_t> + : public __hash_base> { size_t operator()(const _GLIBCXX_STD_D::vector& __b) const; diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset index f452062e1541..017c9e020dd9 100644 --- a/libstdc++-v3/include/debug/bitset +++ b/libstdc++-v3/include/debug/bitset @@ -385,7 +385,7 @@ namespace __debug /// std::hash specialization for bitset. template struct hash<__debug::bitset<_Nb>> - : public std::unary_function<__debug::bitset<_Nb>, size_t> + : public __hash_base> { size_t operator()(const __debug::bitset<_Nb>& __b) const diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index b0846b8f42e3..9004f2902aea 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -584,7 +584,7 @@ namespace __debug /// std::hash specialization for vector. template struct hash<__debug::vector> - : public std::unary_function<__debug::vector, size_t> + : public __hash_base> { size_t operator()(const __debug::vector& __b) const diff --git a/libstdc++-v3/include/profile/bitset b/libstdc++-v3/include/profile/bitset index f6b8249a3219..79175244bed3 100644 --- a/libstdc++-v3/include/profile/bitset +++ b/libstdc++-v3/include/profile/bitset @@ -359,7 +359,7 @@ namespace __profile /// std::hash specialization for bitset. template struct hash<__profile::bitset<_Nb>> - : public std::unary_function<__profile::bitset<_Nb>, size_t> + : public __hash_base> { size_t operator()(const __profile::bitset<_Nb>& __b) const diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector index 1bd4346ec677..cd04b5155996 100644 --- a/libstdc++-v3/include/profile/vector +++ b/libstdc++-v3/include/profile/vector @@ -505,7 +505,7 @@ namespace __profile /// std::hash specialization for vector. template struct hash<__profile::vector> - : public std::unary_function<__profile::vector, size_t> + : public __hash_base> { size_t operator()(const __profile::vector& __b) const diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 6fe1235ee893..d263fae645ac 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -1495,7 +1495,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for bitset. template struct hash<_GLIBCXX_STD_D::bitset<_Nb>> - : public std::unary_function<_GLIBCXX_STD_D::bitset<_Nb>, size_t> + : public __hash_base> { size_t operator()(const _GLIBCXX_STD_D::bitset<_Nb>& __b) const @@ -1507,7 +1507,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template<> struct hash<_GLIBCXX_STD_D::bitset<0>> - : public std::unary_function<_GLIBCXX_STD_D::bitset<0>, size_t> + : public __hash_base> { size_t operator()(const _GLIBCXX_STD_D::bitset<0>&) const diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error index 2c968e92e903..ce4e23825a34 100644 --- a/libstdc++-v3/include/std/system_error +++ b/libstdc++-v3/include/std/system_error @@ -353,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// std::hash specialization for error_code. template<> struct hash - : public std::unary_function + : public __hash_base { size_t operator()(const error_code& __e) const diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index 38e9d45a46d8..d5bbf6e01462 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -56,9 +56,6 @@ namespace std * @{ */ - template - struct hash; - /// thread class thread { @@ -224,7 +221,7 @@ namespace std /// std::hash specialization for thread::id. template<> struct hash - : public std::unary_function + : public __hash_base { size_t operator()(const thread::id& __id) const diff --git a/libstdc++-v3/include/std/typeindex b/libstdc++-v3/include/std/typeindex index a5d37666e78c..44836f67ea3e 100644 --- a/libstdc++-v3/include/std/typeindex +++ b/libstdc++-v3/include/std/typeindex @@ -35,9 +35,7 @@ # include #else -#include #include -#include // For unary_function namespace std { @@ -92,8 +90,10 @@ namespace std /// std::hash specialization for type_index. template<> struct hash - : public std::unary_function { + typedef size_t result_type; + typedef type_index argument_type; + size_t operator()(const type_index& __ti) const { return __ti.hash_code(); }