diff options
author | Howard Hinnant <hhinnant@apple.com> | 2011-12-05 00:08:45 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2011-12-05 00:08:45 +0000 |
commit | f3d14a65ca0bc0e4f7548eb643d5e55e59429b1e (patch) | |
tree | d9fc6aa99af94d687bcab7cd8048002b0607e2e0 /libcxx/include/thread | |
parent | 5fd147f97eb5e4935176f539017727ce74889bc9 (diff) | |
download | bcm5719-llvm-f3d14a65ca0bc0e4f7548eb643d5e55e59429b1e.tar.gz bcm5719-llvm-f3d14a65ca0bc0e4f7548eb643d5e55e59429b1e.zip |
Starting using murmur2 when combining multiple size_t's into a single hash, and also for basic_string. Also made hash<thread::id> ever so slighly more portable. I had to tweak one test which is questionable (definitely not portable) anyway.
llvm-svn: 145795
Diffstat (limited to 'libcxx/include/thread')
-rw-r--r-- | libcxx/include/thread | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libcxx/include/thread b/libcxx/include/thread index 2e8284692fe..23b19158999 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -183,6 +183,9 @@ __thread_id get_id(); } // this_thread +class _LIBCPP_VISIBLE __thread_id; +template<> struct _LIBCPP_VISIBLE hash<__thread_id>; + class _LIBCPP_VISIBLE __thread_id { // FIXME: pthread_t is a pointer on Darwin but a long on Linux. @@ -226,10 +229,9 @@ private: friend __thread_id this_thread::get_id(); friend class _LIBCPP_VISIBLE thread; + friend struct _LIBCPP_VISIBLE hash<__thread_id>; }; -template<class _Tp> struct hash; - template<> struct _LIBCPP_VISIBLE hash<__thread_id> : public unary_function<__thread_id, size_t> @@ -237,8 +239,7 @@ struct _LIBCPP_VISIBLE hash<__thread_id> _LIBCPP_INLINE_VISIBILITY size_t operator()(__thread_id __v) const { - const size_t* const __p = reinterpret_cast<const size_t*>(&__v); - return *__p; + return hash<pthread_t>()(__v.__id_); } }; |