30 #ifndef _FUNCTIONAL_HASH_H
31 #define _FUNCTIONAL_HASH_H 1
33 #pragma GCC system_header
37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
49 template<
typename _Result,
typename _Arg>
52 typedef _Result result_type;
53 typedef _Arg argument_type;
57 template<
typename _Tp>
61 template<
typename _Tp>
62 struct hash<_Tp*> :
public __hash_base<size_t, _Tp*>
65 operator()(_Tp* __p)
const noexcept
66 {
return reinterpret_cast<size_t>(__p); }
70 #define _Cxx_hashtable_define_trivial_hash(_Tp) \
72 struct hash<_Tp> : public __hash_base<size_t, _Tp> \
75 operator()(_Tp __val) const noexcept \
76 { return static_cast<size_t>(__val); } \
80 _Cxx_hashtable_define_trivial_hash(
bool)
83 _Cxx_hashtable_define_trivial_hash(
char)
86 _Cxx_hashtable_define_trivial_hash(
signed char)
89 _Cxx_hashtable_define_trivial_hash(
unsigned char)
92 _Cxx_hashtable_define_trivial_hash(
wchar_t)
95 _Cxx_hashtable_define_trivial_hash(char16_t)
98 _Cxx_hashtable_define_trivial_hash(char32_t)
101 _Cxx_hashtable_define_trivial_hash(
short)
104 _Cxx_hashtable_define_trivial_hash(
int)
107 _Cxx_hashtable_define_trivial_hash(
long)
110 _Cxx_hashtable_define_trivial_hash(
long long)
113 _Cxx_hashtable_define_trivial_hash(
unsigned short)
116 _Cxx_hashtable_define_trivial_hash(
unsigned int)
119 _Cxx_hashtable_define_trivial_hash(
unsigned long)
122 _Cxx_hashtable_define_trivial_hash(
unsigned long long)
124 #undef _Cxx_hashtable_define_trivial_hash
129 hash(
const void* __ptr,
size_t __clength,
130 size_t __seed = static_cast<size_t>(0xc70f6907UL))
131 {
return _Hash_bytes(__ptr, __clength, __seed); }
133 template<
typename _Tp>
135 hash(
const _Tp& __val)
136 {
return hash(&__val,
sizeof(__val)); }
138 template<
typename _Tp>
140 __hash_combine(
const _Tp& __val,
size_t __hash)
141 {
return hash(&__val,
sizeof(__val), __hash); }
144 struct _Fnv_hash_impl
147 hash(
const void* __ptr,
size_t __clength,
148 size_t __seed = static_cast<size_t>(2166136261UL))
149 {
return _Fnv_hash_bytes(__ptr, __clength, __seed); }
151 template<
typename _Tp>
153 hash(
const _Tp& __val)
154 {
return hash(&__val,
sizeof(__val)); }
156 template<
typename _Tp>
158 __hash_combine(
const _Tp& __val,
size_t __hash)
159 {
return hash(&__val,
sizeof(__val), __hash); }
164 struct hash<float> :
public __hash_base<size_t, float>
167 operator()(
float __val)
const noexcept
170 return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
176 struct hash<double> :
public __hash_base<size_t, double>
179 operator()(
double __val)
const noexcept
182 return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
189 :
public __hash_base<size_t, long double>
192 operator()(
long double __val)
const noexcept;
201 template<
typename _Hash>
202 struct __is_fast_hash :
public std::true_type
206 struct __is_fast_hash<hash<long double>> :
public std::false_type
209 _GLIBCXX_END_NAMESPACE_VERSION
212 #endif // _FUNCTIONAL_HASH_H
ISO C++ entities toplevel namespace is std.
Primary class template hash.