OSDN Git Service

2010-03-02 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Mar 2010 21:48:20 +0000 (21:48 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Mar 2010 21:48:20 +0000 (21:48 +0000)
* include/bits/stl_bvector.h (hash<vector<bool, _Alloc>>::
operator()(const vector<bool, _Alloc>&)): Move definition...
* include/bits/vector.tcc: ... here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157178 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/vector.tcc

index c7a4acd..db81761 100644 (file)
@@ -1044,42 +1044,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const;
     };
 
-  template<typename _Alloc>
-    size_t
-    hash<_GLIBCXX_STD_D::vector<bool, _Alloc>>::
-    operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const
-    {
-      size_t __hash = 0;
-      using _GLIBCXX_STD_D::_S_word_bit;
-      using _GLIBCXX_STD_D::_Bit_type;
-
-      const size_t __words = __b.size() / _S_word_bit;
-      if (__words)
-       {
-         const char* __data
-           = reinterpret_cast<const char*>(__b._M_impl._M_start._M_p);
-         const size_t __size = __words * sizeof(_Bit_type);
-         __hash = std::_Fnv_hash::hash(__data, __size);
-       }
-
-      const size_t __extrabits = __b.size() % _S_word_bit;
-      if (__extrabits)
-       {
-         _Bit_type __hiword = *__b._M_impl._M_finish._M_p;
-         __hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits);
-
-         const char* __data = reinterpret_cast<const char*>(&__hiword);
-         const size_t __size
-           = (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__;
-         if (__words)
-           __hash = std::_Fnv_hash::hash(__data, __size, __hash);
-         else
-           __hash = std::_Fnv_hash::hash(__data, __size);
-       }
-
-      return __hash;
-    }
-
 _GLIBCXX_END_NAMESPACE
 
 #endif // __GXX_EXPERIMENTAL_CXX0X__
index 8f67493..984f83f 100644 (file)
@@ -1,6 +1,6 @@
 // Vector implementation (out of line) -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -678,4 +678,48 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
 
 _GLIBCXX_END_NESTED_NAMESPACE
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  template<typename _Alloc>
+    size_t
+    hash<_GLIBCXX_STD_D::vector<bool, _Alloc>>::
+    operator()(const _GLIBCXX_STD_D::vector<bool, _Alloc>& __b) const
+    {
+      size_t __hash = 0;
+      using _GLIBCXX_STD_D::_S_word_bit;
+      using _GLIBCXX_STD_D::_Bit_type;
+
+      const size_t __words = __b.size() / _S_word_bit;
+      if (__words)
+       {
+         const char* __data
+           = reinterpret_cast<const char*>(__b._M_impl._M_start._M_p);
+         const size_t __size = __words * sizeof(_Bit_type);
+         __hash = std::_Fnv_hash::hash(__data, __size);
+       }
+
+      const size_t __extrabits = __b.size() % _S_word_bit;
+      if (__extrabits)
+       {
+         _Bit_type __hiword = *__b._M_impl._M_finish._M_p;
+         __hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits);
+
+         const char* __data = reinterpret_cast<const char*>(&__hiword);
+         const size_t __size
+           = (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__;
+         if (__words)
+           __hash = std::_Fnv_hash::hash(__data, __size, __hash);
+         else
+           __hash = std::_Fnv_hash::hash(__data, __size);
+       }
+
+      return __hash;
+    }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
 #endif /* _VECTOR_TCC */