57 #ifndef LIB_HASH_STANDARD_H 58 #define LIB_HASH_STANDARD_H 59 #ifdef _FUNCTIONAL_HASH_H 60 #error "unable to hijack std::hash, since <bits/functional_hash.hpp> has already been included. \ 61 Please ensure that lib/hash_standard.hpp is included first, before including <string> or <functional>" 75 typedef size_t HasUsableHashDefinition;
87 TY
const& unusedDummy = *(TY*)
nullptr;
90 enum{ value = (
sizeof(HasUsableHashDefinition) ==
sizeof(
hash_value(unusedDummy))) };
99 template<
typename Result,
typename Arg>
103 template<
typename TY,
typename TOGGLE =
void>
107 static_assert (
sizeof(TY) < 0,
"No hash implementation found. " 108 "Either specialise std::hash or provide a boost-style hash_value via ADL.");
112 typedef int NotHashable;
118 template<
typename TY>
123 operator() (TY
const& elm)
const noexcept
138 template<
typename TY>
150 #define hash hash_HIDDEN 151 #define _Hash_impl _Hash_impl_HIDDEN 152 #include <bits/c++config.h> 153 #include <bits/functional_hash.h> 169 :
public std::_Hash_impl_HIDDEN
171 template<
typename ... ARGS>
173 hash (ARGS&&... args) -> decltype(hash_HIDDEN (std::forward<ARGS>(args)...))
175 return hash_HIDDEN (std::forward<ARGS>(args)...);
184 #define STD_HASH_IMPL(_TY_) \ 185 template<> struct hash<_TY_> : public hash_HIDDEN<_TY_> { }; 189 STD_HASH_IMPL (
signed char)
190 STD_HASH_IMPL (
unsigned char)
191 STD_HASH_IMPL (
wchar_t)
192 STD_HASH_IMPL (char16_t)
193 STD_HASH_IMPL (char32_t)
194 STD_HASH_IMPL (
short)
197 STD_HASH_IMPL (
long long)
198 STD_HASH_IMPL (
unsigned short)
199 STD_HASH_IMPL (
unsigned int)
200 STD_HASH_IMPL (
unsigned long)
201 STD_HASH_IMPL (
unsigned long long)
202 STD_HASH_IMPL (
float)
203 STD_HASH_IMPL (
double)
204 STD_HASH_IMPL (
long double)
Primary class template for std::hash.
Implementation namespace for support and library code.
HashVal hash_value(QueryText const &entry)
support using queries in hashtables.
Hash value types and utilities.