66 #ifndef LIB_HASH_STANDARD_H 67 #define LIB_HASH_STANDARD_H 68 #ifdef _FUNCTIONAL_HASH_H 69 #error "unable to hijack std::hash, since <bits/functional_hash.hpp> has already been included. \ 70 Please ensure that lib/hash_standard.hpp is included first, before including <string> or <functional>" 84 typedef size_t HasUsableHashDefinition;
96 TY
const& unusedDummy = *(TY*)
nullptr;
99 enum{ value = (
sizeof(HasUsableHashDefinition) ==
sizeof(
hash_value(unusedDummy))) };
108 template<
typename Result,
typename Arg>
112 template<
typename TY,
typename TOGGLE =
void>
116 static_assert (
sizeof(TY) < 0,
"No hash implementation found. " 117 "Either specialise std::hash or provide a boost-style hash_value via ADL.");
121 typedef int NotHashable;
127 template<
typename TY>
132 operator() (TY
const& elm)
const noexcept
147 template<
typename TY>
159 #define hash hash_HIDDEN 160 #define _Hash_impl _Hash_impl_HIDDEN 161 #include <bits/c++config.h> 162 #include <bits/functional_hash.h> 178 :
public std::_Hash_impl_HIDDEN
180 template<
typename ... ARGS>
182 hash (ARGS&&... args) -> decltype(hash_HIDDEN (std::forward<ARGS>(args)...))
184 return hash_HIDDEN (std::forward<ARGS>(args)...);
193 #define STD_HASH_IMPL(_TY_) \ 194 template<> struct hash<_TY_> : public hash_HIDDEN<_TY_> { }; 198 STD_HASH_IMPL (
signed char)
199 STD_HASH_IMPL (
unsigned char)
200 STD_HASH_IMPL (
wchar_t)
201 STD_HASH_IMPL (char16_t)
202 STD_HASH_IMPL (char32_t)
203 STD_HASH_IMPL (
short)
206 STD_HASH_IMPL (
long long)
207 STD_HASH_IMPL (
unsigned short)
208 STD_HASH_IMPL (
unsigned int)
209 STD_HASH_IMPL (
unsigned long)
210 STD_HASH_IMPL (
unsigned long long)
211 STD_HASH_IMPL (
float)
212 STD_HASH_IMPL (
double)
213 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.