forked from boostorg/container_hash
Update hash_value for pointers to handle the case when uintptr_t is larger than size_t
This commit is contained in:
@@ -344,12 +344,11 @@ namespace boost
|
|||||||
|
|
||||||
// pointer types
|
// pointer types
|
||||||
|
|
||||||
// Implementation by Alberto Barbati and Dave Harris.
|
// `x + (x >> 3)` adjustment by Alberto Barbati and Dave Harris.
|
||||||
template <class T> std::size_t hash_value( T* const& v )
|
template <class T> std::size_t hash_value( T* const& v )
|
||||||
{
|
{
|
||||||
std::size_t x = static_cast<std::size_t>(
|
boost::uintptr_t x = reinterpret_cast<boost::uintptr_t>( v );
|
||||||
reinterpret_cast<boost::uintptr_t>(v));
|
return boost::hash_value( x + (x >> 3) );
|
||||||
return x + (x >> 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// array types
|
// array types
|
||||||
|
Reference in New Issue
Block a user