diff --git a/src/common/HashUtils.h b/src/common/HashUtils.h index c42b60e02e..a316dbcd80 100644 --- a/src/common/HashUtils.h +++ b/src/common/HashUtils.h @@ -16,6 +16,7 @@ #define COMMON_HASHUTILS_H_ #include "common/Platform.h" +#include "common/TypedInteger.h" #include #include @@ -27,6 +28,12 @@ size_t Hash(const T& value) { return std::hash()(value); } +// Add hashing of TypedIntegers +template +size_t Hash(const TypedInteger& value) { + return Hash(static_cast(value)); +} + // When hashing sparse structures we want to iteratively build a hash value with only parts of the // data. HashCombine "hashes" together an existing hash and hashable values. // diff --git a/src/common/TypedInteger.h b/src/common/TypedInteger.h index 05450ec258..dd06331cd6 100644 --- a/src/common/TypedInteger.h +++ b/src/common/TypedInteger.h @@ -193,6 +193,7 @@ namespace detail { } // namespace detail namespace std { + template class numeric_limits> : public numeric_limits { public: @@ -204,14 +205,6 @@ namespace std { } }; - template - class hash> : private hash { - public: - size_t operator()(detail::TypedIntegerImpl value) const { - return hash::operator()(static_cast(value)); - } - }; - } // namespace std #endif // COMMON_TYPEDINTEGER_H_