forked from boostorg/container_hash
Move std::unique_ptr, std::shared_ptr support into hash.hpp
This commit is contained in:
@@ -26,10 +26,6 @@
|
||||
# include <tuple>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||
# include <memory>
|
||||
#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 <typename T>
|
||||
inline std::size_t hash_value(std::shared_ptr<T> const& x) {
|
||||
return boost::hash_value(x.get());
|
||||
}
|
||||
|
||||
template <typename T, typename Deleter>
|
||||
inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) {
|
||||
return boost::hash_value(x.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@@ -34,6 +34,10 @@
|
||||
#include <utility>
|
||||
#include <climits>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||
# include <memory>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
|
||||
#include <typeindex>
|
||||
#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 <typename T>
|
||||
std::size_t hash_value( std::shared_ptr<T> const& x )
|
||||
{
|
||||
return boost::hash_value( x.get() );
|
||||
}
|
||||
|
||||
template <typename T, typename Deleter>
|
||||
std::size_t hash_value( std::unique_ptr<T, Deleter> const& x )
|
||||
{
|
||||
return boost::hash_value( x.get() );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// std::type_index
|
||||
|
Reference in New Issue
Block a user