public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6227] libstdc++: Move std::hash<std::thread::id> to <bits/std_thread.h>
@ 2020-12-17 14:03 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-12-17 14:03 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:8cdca5f9c706af118390489efc94336f6214f515

commit r11-6227-g8cdca5f9c706af118390489efc94336f6214f515
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Dec 17 11:59:07 2020 +0000

    libstdc++: Move std::hash<std::thread::id> to <bits/std_thread.h>
    
    This makes the hash function available without including the whole of
    <thread>, which is needed for <barrier>.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/std_thread.h (hash<thread::id>): Move here,
            from ...
            * include/std/thread (hash<thread::id>): ... here.

Diff:
---
 libstdc++-v3/include/bits/std_thread.h | 12 ++++++++++++
 libstdc++-v3/include/std/thread        | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libstdc++-v3/include/bits/std_thread.h b/libstdc++-v3/include/bits/std_thread.h
index 24bd5fbd44e..4810d355695 100644
--- a/libstdc++-v3/include/bits/std_thread.h
+++ b/libstdc++-v3/include/bits/std_thread.h
@@ -38,6 +38,7 @@
 #include <exception>		// std::terminate
 #include <iosfwd>		// std::basic_ostream
 #include <tuple>		// std::tuple
+#include <bits/functional_hash.h> // std::hash
 #include <bits/invoke.h>	// std::__invoke
 #include <bits/refwrap.h>       // not required, but helpful to users
 #include <bits/unique_ptr.h>	// std::unique_ptr
@@ -288,6 +289,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // N.B. other comparison operators are defined in <thread>
 
+  // DR 889.
+  /// std::hash specialization for thread::id.
+  template<>
+    struct hash<thread::id>
+    : public __hash_base<size_t, thread::id>
+    {
+      size_t
+      operator()(const thread::id& __id) const noexcept
+      { return std::_Hash_impl::hash(__id._M_thread); }
+    };
+
   namespace this_thread
   {
     /// this_thread::get_id
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index 8d0ede2b6c2..10fb9e631be 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -43,7 +43,6 @@
 #endif
 
 #include <bits/std_thread.h> // std::thread, get_id, yield
-#include <bits/functional_hash.h> // std::hash
 
 #ifdef _GLIBCXX_USE_NANOSLEEP
 # include <cerrno>  // errno, EINTR
@@ -94,17 +93,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   { return !(__x < __y); }
 #endif // __cpp_lib_three_way_comparison
 
-  // DR 889.
-  /// std::hash specialization for thread::id.
-  template<>
-    struct hash<thread::id>
-    : public __hash_base<size_t, thread::id>
-    {
-      size_t
-      operator()(const thread::id& __id) const noexcept
-      { return std::_Hash_impl::hash(__id._M_thread); }
-    };
-
   template<class _CharT, class _Traits>
     inline basic_ostream<_CharT, _Traits>&
     operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-17 14:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 14:03 [gcc r11-6227] libstdc++: Move std::hash<std::thread::id> to <bits/std_thread.h> Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).