From: Jonathan Wakely Date: Thu, 17 Dec 2020 11:59:07 +0000 (+0000) Subject: libstdc++: Move std::hash to X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cdca5f9c706af118390489efc94336f6214f515;p=gcc.git libstdc++: Move std::hash to This makes the hash function available without including the whole of , which is needed for . libstdc++-v3/ChangeLog: * include/bits/std_thread.h (hash): Move here, from ... * include/std/thread (hash): ... here. --- 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 // std::terminate #include // std::basic_ostream #include // std::tuple +#include // std::hash #include // std::__invoke #include // not required, but helpful to users #include // std::unique_ptr @@ -288,6 +289,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // N.B. other comparison operators are defined in + // DR 889. + /// std::hash specialization for thread::id. + template<> + struct hash + : public __hash_base + { + 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 // std::thread, get_id, yield -#include // std::hash #ifdef _GLIBCXX_USE_NANOSLEEP # include // 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 - : public __hash_base - { - size_t - operator()(const thread::id& __id) const noexcept - { return std::_Hash_impl::hash(__id._M_thread); } - }; - template inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, thread::id __id)