fix issue for using hash_value() as a way to implement hash in a class

This commit is contained in:
greg
2019-11-03 14:45:25 -05:00
parent c472488375
commit 64f1b82a54
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#include "hash_std.h" // defines Person with std::hash specialization #include "hash_value.h" // defines Person with std::hash specialization
#include <iostream> #include <iostream>
#include <parallel_hashmap/phmap.h> #include <parallel_hashmap/phmap.h>
+2 -2
View File
@@ -116,7 +116,7 @@ private:
typedef std::true_type yes; typedef std::true_type yes;
typedef std::false_type no; typedef std::false_type no;
template<typename U> static auto test(int) -> decltype(U::hash_value(std::declval<U&>()) == 1, yes()); template<typename U> static auto test(int) -> decltype(hash_value(std::declval<U&>()) == 1, yes());
template<typename> static no test(...); template<typename> static no test(...);
@@ -137,7 +137,7 @@ struct Hash
template <class U, typename std::enable_if<has_hash_value<U>::value, int>::type = 0> template <class U, typename std::enable_if<has_hash_value<U>::value, int>::type = 0>
size_t _hash(const T& val) const size_t _hash(const T& val) const
{ {
return U::hash_value(val); return hash_value(val);
} }
template <class U, typename std::enable_if<!has_hash_value<U>::value, int>::type = 0> template <class U, typename std::enable_if<!has_hash_value<U>::value, int>::type = 0>