Revert "Change HashCompatible trait to a variable template"
This reverts commit b58f72315c
.
Unfortunately gcc-5.1 handling of variable template partial
specializations is bugged.
This commit is contained in:
parent
65bac9c027
commit
1688332d12
|
@ -61,10 +61,12 @@ struct Hash
|
||||||
// Traits specifying if two types have compatible hashing, that is,
|
// Traits specifying if two types have compatible hashing, that is,
|
||||||
// if lhs == rhs => hash_value(lhs) == hash_value(rhs)
|
// if lhs == rhs => hash_value(lhs) == hash_value(rhs)
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
constexpr bool HashCompatible = false;
|
struct HashCompatible : std::false_type {};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T> struct HashCompatible<T, T> : std::true_type {};
|
||||||
constexpr bool HashCompatible<T, T> = true;
|
|
||||||
|
template<typename Lhs, typename Rhs>
|
||||||
|
constexpr bool IsHashCompatible = HashCompatible<Lhs, Rhs>::value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ struct HashMap
|
||||||
|
|
||||||
template<typename KeyType>
|
template<typename KeyType>
|
||||||
using EnableIfHashCompatible = std::enable_if_t<
|
using EnableIfHashCompatible = std::enable_if_t<
|
||||||
HashCompatible<Key, std::decay_t<KeyType>>
|
IsHashCompatible<Key, std::decay_t<KeyType>>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
template<typename KeyType, typename = EnableIfHashCompatible<KeyType>>
|
template<typename KeyType, typename = EnableIfHashCompatible<KeyType>>
|
||||||
|
|
|
@ -256,8 +256,8 @@ private:
|
||||||
|
|
||||||
static_assert(std::is_trivial<StringView>::value, "");
|
static_assert(std::is_trivial<StringView>::value, "");
|
||||||
|
|
||||||
template<> constexpr bool HashCompatible<String, StringView> = true;
|
template<> struct HashCompatible<String, StringView> : std::true_type {};
|
||||||
template<> constexpr bool HashCompatible<StringView, String> = true;
|
template<> struct HashCompatible<StringView, String> : std::true_type {};
|
||||||
|
|
||||||
inline String::String(StringView str) : String{str.begin(), str.length()} {}
|
inline String::String(StringView str) : String{str.begin(), str.length()} {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user