diff options
| author | Paolo Carlini <paolo.carlini@oracle.com> | 2010-02-23 15:23:37 +0000 |
|---|---|---|
| committer | Paolo Carlini <paolo@gcc.gnu.org> | 2010-02-23 15:23:37 +0000 |
| commit | 5c8db18ac645579a5974abb6ad0ed922b14dcb32 (patch) | |
| tree | 5a389c42914e410ce5375c1480147999b90aeb07 /libstdc++-v3/src | |
| parent | 0f9c8f569d2bdb6c8b0cd57fd3fd95acb9204029 (diff) | |
| download | gcc-5c8db18ac645579a5974abb6ad0ed922b14dcb32.tar.gz gcc-5c8db18ac645579a5974abb6ad0ed922b14dcb32.tar.bz2 gcc-5c8db18ac645579a5974abb6ad0ed922b14dcb32.zip | |
functional_hash.h (struct _Fnv_hash): Rename to _Fnv_hash_base.
2010-02-23 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/functional_hash.h (struct _Fnv_hash): Rename
to _Fnv_hash_base.
(struct _Fnv_hash): Add, derives from the latter.
(__hash_combine): Add.
(hash<float>::operator()(float), hash<double>::operator()(double)):
Adjust.
* include/bits/basic_string.h (hash<string>, hash<wstring>,
hash<u16string>, hash<u32string>): Adjust.
* src/hash-string-aux.cc: Adjust.
* src/compatibility-c++0x.cc (hash<error_code>): Use __hash_combine.
* include/std/system_error (hash<error_code>): Likewise.
* include/std/thread (struct hash<thread::id>): Add.
* include/tr1/functional_hash.h : Rename to _Fnv_hash_base.
(struct _Fnv_hash): Add, derives from the latter.
(hash<float>::operator()(float), hash<double>::operator()(double)):
Adjust.
* testsuite/30_threads/thread/id/hash.cc: New.
* testsuite/30_threads/thread/cons/assign_neg.cc: Adjust dg-error
line number.
* testsuite/30_threads/thread/cons/copy_neg.cc: Likewise.
From-SVN: r157005
Diffstat (limited to 'libstdc++-v3/src')
| -rw-r--r-- | libstdc++-v3/src/compatibility-c++0x.cc | 6 | ||||
| -rw-r--r-- | libstdc++-v3/src/hash-string-aux.cc | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libstdc++-v3/src/compatibility-c++0x.cc b/libstdc++-v3/src/compatibility-c++0x.cc index abdc72c0832..7dd57680484 100644 --- a/libstdc++-v3/src/compatibility-c++0x.cc +++ b/libstdc++-v3/src/compatibility-c++0x.cc @@ -55,8 +55,8 @@ namespace std template<> size_t hash<error_code>::operator()(error_code __e) const - { - const char* __p = reinterpret_cast<const char*>(&__e); - return _Fnv_hash<>::hash(__p, sizeof(__e)); + { + const size_t __tmp = std::_Fnv_hash::hash(__e._M_value); + return std::__hash_combine(__tmp, __e._M_cat); } } diff --git a/libstdc++-v3/src/hash-string-aux.cc b/libstdc++-v3/src/hash-string-aux.cc index 1da015c1fd5..b5a2c6ddc3d 100644 --- a/libstdc++-v3/src/hash-string-aux.cc +++ b/libstdc++-v3/src/hash-string-aux.cc @@ -26,12 +26,12 @@ template<> size_t hash<string>::operator()(string __s) const - { return _Fnv_hash<>::hash(__s.data(), __s.length()); } + { return _Fnv_hash::hash(__s.data(), __s.length()); } template<> size_t hash<const string&>::operator()(const string& __s) const - { return _Fnv_hash<>::hash(__s.data(), __s.length()); } + { return _Fnv_hash::hash(__s.data(), __s.length()); } #ifdef _GLIBCXX_USE_WCHAR_T template<> @@ -39,7 +39,7 @@ hash<wstring>::operator()(wstring __s) const { const char* __p = reinterpret_cast<const char*>(__s.data()); - return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t)); + return _Fnv_hash::hash(__p, __s.length() * sizeof(wchar_t)); } template<> @@ -47,7 +47,7 @@ hash<const wstring&>::operator()(const wstring& __s) const { const char* __p = reinterpret_cast<const char*>(__s.data()); - return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t)); + return _Fnv_hash::hash(__p, __s.length() * sizeof(wchar_t)); } #endif |
