mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-29 08:34:39 +08:00
fix issue for using hash_value() as a way to implement hash in a class
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Vendored
+2
-2
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user