From a63c85007fa85840c884e043e7fc3c8a6587a878 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 17 Oct 2021 02:14:19 +0300 Subject: [PATCH] Move std::unique_ptr, std::shared_ptr support into hash.hpp --- include/boost/container_hash/extensions.hpp | 16 --------------- include/boost/container_hash/hash.hpp | 22 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/include/boost/container_hash/extensions.hpp b/include/boost/container_hash/extensions.hpp index 94adfa5..cc1a421 100644 --- a/include/boost/container_hash/extensions.hpp +++ b/include/boost/container_hash/extensions.hpp @@ -26,10 +26,6 @@ # include #endif -#if !defined(BOOST_NO_CXX11_SMART_PTR) -# include -#endif - namespace boost { #if !defined(BOOST_NO_CXX11_HDR_TUPLE) @@ -134,18 +130,6 @@ namespace boost #endif -#endif - -#if !defined(BOOST_NO_CXX11_SMART_PTR) - template - inline std::size_t hash_value(std::shared_ptr const& x) { - return boost::hash_value(x.get()); - } - - template - inline std::size_t hash_value(std::unique_ptr const& x) { - return boost::hash_value(x.get()); - } #endif // diff --git a/include/boost/container_hash/hash.hpp b/include/boost/container_hash/hash.hpp index 4ab436b..c4ba130 100644 --- a/include/boost/container_hash/hash.hpp +++ b/include/boost/container_hash/hash.hpp @@ -34,6 +34,10 @@ #include #include +#if !defined(BOOST_NO_CXX11_SMART_PTR) +# include +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) #include #endif @@ -244,6 +248,24 @@ namespace boost return boost::hash_unordered_range( v.begin(), v.end() ); } +#endif + + // std::unique_ptr, std::shared_ptr + +#if !defined(BOOST_NO_CXX11_SMART_PTR) + + template + std::size_t hash_value( std::shared_ptr const& x ) + { + return boost::hash_value( x.get() ); + } + + template + std::size_t hash_value( std::unique_ptr const& x ) + { + return boost::hash_value( x.get() ); + } + #endif // std::type_index