aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2010-03-02 21:48:20 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-03-02 21:48:20 +0000
commitf54e96d971e7af247c87e1df9cdb7b5b11f211ff (patch)
tree43623e7ec37cce68b51fe6b3b00445dc881b132f /libstdc++-v3
parentd903b2a134a3a58bb5e36dba31eaa5659302ec55 (diff)
downloadgcc-f54e96d971e7af247c87e1df9cdb7b5b11f211ff.zip
gcc-f54e96d971e7af247c87e1df9cdb7b5b11f211ff.tar.gz
gcc-f54e96d971e7af247c87e1df9cdb7b5b11f211ff.tar.bz2
stl_bvector.h (hash<vector<bool, [...]): Move definition...
2010-03-02 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/stl_bvector.h (hash<vector<bool, _Alloc>>:: operator()(const vector<bool, _Alloc>&)): Move definition... * include/bits/vector.tcc: ... here. From-SVN: r157178
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h36
-rw-r--r--libstdc++-v3/include/bits/vector.tcc46
2 files changed, 45 insertions, 37 deletions
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index c7a4acd..db81761 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -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__
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index 8f67493..984f83f 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -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 */