From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id D2B8A38930FE; Thu, 17 Dec 2020 14:03:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2B8A38930FE MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-6227] libstdc++: Move std::hash to X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: f5feee6adc8350a292c235eb21e31a5082350d94 X-Git-Newrev: 8cdca5f9c706af118390489efc94336f6214f515 Message-Id: <20201217140331.D2B8A38930FE@sourceware.org> Date: Thu, 17 Dec 2020 14:03:31 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2020 14:03:31 -0000 https://gcc.gnu.org/g:8cdca5f9c706af118390489efc94336f6214f515 commit r11-6227-g8cdca5f9c706af118390489efc94336f6214f515 Author: Jonathan Wakely Date: Thu Dec 17 11:59:07 2020 +0000 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: --- 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 // 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)