diff options
| author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-23 15:23:37 +0000 |
|---|---|---|
| committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-02-23 15:23:37 +0000 |
| commit | 3103d73cdcd9f75c792c1213d242371410ea4fb7 (patch) | |
| tree | 5a389c42914e410ce5375c1480147999b90aeb07 /libstdc++-v3/include/std/thread | |
| parent | d96f9313aeb7cc7816eb9abfabb5ee1dcd5499ef (diff) | |
| download | ppe42-gcc-3103d73cdcd9f75c792c1213d242371410ea4fb7.tar.gz ppe42-gcc-3103d73cdcd9f75c792c1213d242371410ea4fb7.zip | |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157005 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/thread')
| -rw-r--r-- | libstdc++-v3/include/std/thread | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index f72f5e5a3a6..470f2c0f35c 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -42,6 +42,7 @@ #include <condition_variable> #include <cstddef> #include <bits/functexcept.h> +#include <bits/functional_hash.h> #include <bits/gthr.h> #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) @@ -56,6 +57,9 @@ namespace std * @{ */ + template<typename _Tp> + struct hash; + /// thread class thread { @@ -77,6 +81,7 @@ namespace std private: friend class thread; + friend class hash<thread::id>; friend bool operator==(thread::id __x, thread::id __y) @@ -215,6 +220,17 @@ namespace std operator>=(thread::id __x, thread::id __y) { return !(__x < __y); } + // DR 889. + /// std::hash specialization for thread::id. + template<> + struct hash<thread::id> + : public std::unary_function<thread::id, size_t> + { + size_t + operator()(const thread::id& __id) const + { return std::_Fnv_hash::hash(__id._M_thread); } + }; + template<class _CharT, class _Traits> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id) |

