]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
functional_hash.h (__hash_base): Add.
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 22 Sep 2010 17:50:36 +0000 (17:50 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 22 Sep 2010 17:50:36 +0000 (17:50 +0000)
2010-09-22  Paolo Carlini  <paolo.carlini@oracle.com>

* 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

12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/bits/functional_hash.h
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/debug/bitset
libstdc++-v3/include/debug/vector
libstdc++-v3/include/profile/bitset
libstdc++-v3/include/profile/vector
libstdc++-v3/include/std/bitset
libstdc++-v3/include/std/system_error
libstdc++-v3/include/std/thread
libstdc++-v3/include/std/typeindex

index 58171dce3dd93b65df94cf25d244123728dc90b5..8f5dc71af88c0a7f2596b41361e27f22058c5a93 100644 (file)
@@ -1,3 +1,19 @@
+2010-09-22  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * 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  <paolo.carlini@oracle.com>
 
        * include/std/typeindex: New.
index 2fb671721ab334ed62c5ba2a53eb20f11b8a4e80..308285bec86dea1083be0324696c28f11fb388a6 100644 (file)
@@ -2925,7 +2925,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for string.
   template<>
     struct hash<string>
-    : public std::unary_function<string, size_t>
+    : public __hash_base<size_t, string>
     {
       size_t
       operator()(const string& __s) const
@@ -2936,7 +2936,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for wstring.
   template<>
     struct hash<wstring>
-    : public std::unary_function<wstring, size_t>
+    : public __hash_base<size_t, wstring>
     {
       size_t
       operator()(const wstring& __s) const
@@ -2950,7 +2950,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for u16string.
   template<>
     struct hash<u16string>
-    : public std::unary_function<u16string, size_t>
+    : public __hash_base<size_t, u16string>
     {
       size_t
       operator()(const u16string& __s) const
@@ -2961,7 +2961,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for u32string.
   template<>
     struct hash<u32string>
-    : public std::unary_function<u32string, size_t>
+    : public __hash_base<size_t, u32string>
     {
       size_t
       operator()(const u32string& __s) const
index 363968788924c74f81a00d6b3ef14e4104292094..a132cce76896bdb83c0e06883a739940d5d92121 100644 (file)
@@ -33,7 +33,6 @@
 #pragma GCC system_header
 
 #include <bits/c++config.h>
-#include <bits/stl_function.h>
 
 namespace std
 {
@@ -45,9 +44,16 @@ namespace std
    *  @{
    */
 
+  template<typename _Result, typename _Arg>
+    struct __hash_base
+    {
+      typedef _Result     result_type;
+      typedef _Arg      argument_type;
+    };
+
   /// Primary class template hash.
   template<typename _Tp>
-    struct hash : public std::unary_function<_Tp, size_t>
+    struct hash : public __hash_base<size_t, _Tp>
     {
       size_t
       operator()(_Tp __val) const;
@@ -55,7 +61,7 @@ namespace std
 
   /// Partial specializations for pointer types.
   template<typename _Tp>
-    struct hash<_Tp*> : public std::unary_function<_Tp*, size_t>
+    struct hash<_Tp*> : public __hash_base<size_t, _Tp*>
     {
       size_t
       operator()(_Tp* __p) const
index c489b447ca15e46a25857f852c5efd92a60a73b7..74c2e85fd70a4c7da770f25429b039bf05f576d9 100644 (file)
@@ -1038,7 +1038,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for vector<bool>.
   template<typename _Alloc>
     struct hash<_GLIBCXX_STD_D::vector<bool, _Alloc>>
-    : public std::unary_function<_GLIBCXX_STD_D::vector<bool, _Alloc>, size_t>
+    : public __hash_base<size_t, _GLIBCXX_STD_D::vector<bool, _Alloc>>
     {
       size_t
       operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const;
index f452062e15419ac55c127b509914a8ab73822ed4..017c9e020dd9108c9877c1dbc5799c883f876485 100644 (file)
@@ -385,7 +385,7 @@ namespace __debug
   /// std::hash specialization for bitset.
   template<size_t _Nb>
     struct hash<__debug::bitset<_Nb>>
-    : public std::unary_function<__debug::bitset<_Nb>, size_t>
+    : public __hash_base<size_t, __debug::bitset<_Nb>>
     {
       size_t
       operator()(const __debug::bitset<_Nb>& __b) const
index b0846b8f42e32a7807ba3650393f55c7eb916f17..9004f2902aeaedffb79561e90dce0edc159fe5d1 100644 (file)
@@ -584,7 +584,7 @@ namespace __debug
   /// std::hash specialization for vector<bool>.
   template<typename _Alloc>
     struct hash<__debug::vector<bool, _Alloc>>
-    : public std::unary_function<__debug::vector<bool, _Alloc>, size_t>
+    : public __hash_base<size_t, __debug::vector<bool, _Alloc>>
     {
       size_t
       operator()(const __debug::vector<bool, _Alloc>& __b) const
index f6b8249a32193e1ade68c843ba27472f962d80d2..79175244bed3c26a8db4456cf293e20816db4a90 100644 (file)
@@ -359,7 +359,7 @@ namespace __profile
   /// std::hash specialization for bitset.
   template<size_t _Nb>
     struct hash<__profile::bitset<_Nb>>
-    : public std::unary_function<__profile::bitset<_Nb>, size_t>
+    : public __hash_base<size_t, __profile::bitset<_Nb>>
     {
       size_t
       operator()(const __profile::bitset<_Nb>& __b) const
index 1bd4346ec6770a31b1f25c222095814cffb0b0ac..cd04b5155996ef0bda702ad998f6cb9f1861587a 100644 (file)
@@ -505,7 +505,7 @@ namespace __profile
   /// std::hash specialization for vector<bool>.
   template<typename _Alloc>
     struct hash<__profile::vector<bool, _Alloc>>
-    : public std::unary_function<__profile::vector<bool, _Alloc>, size_t>
+    : public __hash_base<size_t, __profile::vector<bool, _Alloc>>
     {
       size_t
       operator()(const __profile::vector<bool, _Alloc>& __b) const
index 6fe1235ee89388bb973df8a9f494259c7558da3d..d263fae645acf98bb20ba8fb3b41e5359eed24ed 100644 (file)
@@ -1495,7 +1495,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for bitset.
   template<size_t _Nb>
     struct hash<_GLIBCXX_STD_D::bitset<_Nb>>
-    : public std::unary_function<_GLIBCXX_STD_D::bitset<_Nb>, size_t>
+    : public __hash_base<size_t, _GLIBCXX_STD_D::bitset<_Nb>>
     {
       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, _GLIBCXX_STD_D::bitset<0>>
     {
       size_t
       operator()(const _GLIBCXX_STD_D::bitset<0>&) const
index 2c968e92e9032b4959c489471192639a65b313e7..ce4e23825a34a580e156febab518ad52b8469a16 100644 (file)
@@ -353,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// std::hash specialization for error_code.
   template<>
     struct hash<error_code>
-    : public std::unary_function<error_code, size_t>
+    : public __hash_base<size_t, error_code>
     {
       size_t
       operator()(const error_code& __e) const
index 38e9d45a46d8cb38e1094bd6f9cac89d67ea56ae..d5bbf6e0146299ceec141066c9b59b657e7a0547 100644 (file)
@@ -56,9 +56,6 @@ namespace std
    * @{
    */
 
-  template<typename _Tp>
-    struct hash;
-
   /// thread
   class thread
   {
@@ -224,7 +221,7 @@ namespace std
   /// std::hash specialization for thread::id.
   template<>
     struct hash<thread::id>
-    : public std::unary_function<thread::id, size_t>
+    : public __hash_base<size_t, thread::id>
     {
       size_t
       operator()(const thread::id& __id) const
index a5d37666e78cfe21b98247960d71f382014d4f00..44836f67ea3e6d26d528a2ef95cfd129e99cac32 100644 (file)
@@ -35,9 +35,7 @@
 # include <bits/c++0x_warning.h>
 #else
 
-#include <bits/c++config.h>
 #include <typeinfo>
-#include <bits/stl_function.h> // For unary_function
 
 namespace std
 {
@@ -92,8 +90,10 @@ namespace std
   /// std::hash specialization for type_index.
   template<>
     struct hash<type_index>
-    : public std::unary_function<type_index, size_t>
     {
+      typedef size_t        result_type;
+      typedef type_index  argument_type;
+
       size_t
       operator()(const type_index& __ti) const
       { return __ti.hash_code(); }