Revert hash_value for std::complex

This commit is contained in:
Peter Dimov committed 2022-05-29 21:59:17 +03:00
1 parent 7ad0365048
commit f08204e29a
2 files changed
+14 -17

No files matched your search

+6 -7
View File
@@ -86,8 +86,8 @@ namespace boost
{
static std::size_t fn( T v )
{
// The bias makes negative numbers that fit into a ssize_t hash to themselves
// E.g. hash_value( -4LL ) == (size_t)-4
// The bias makes negative numbers that fit into a ssize_t hash to themselves
// E.g. hash_value( -4LL ) == (size_t)-4
std::size_t const bias = (std::numeric_limits<std::size_t>::max)() / 4;
@@ -252,12 +252,11 @@ namespace boost
template <class T>
std::size_t hash_value( std::complex<T> const& v )
{
std::size_t seed = 0;
std::size_t re = boost::hash<T>()( v.real() );
std::size_t im = boost::hash<T>()( v.imag() );
boost::hash_combine( seed, v.real() );
boost::hash_combine( seed, v.imag() );
return seed;
im ^= re + ( im << 6 ) + ( im >> 2 );
return im;
}
// pair