File indexing completed on 2026-05-03 08:13:31
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___FUNCTIONAL_HASH_H
0010 #define _LIBCPP___CXX03___FUNCTIONAL_HASH_H
0011
0012 #include <__cxx03/__config>
0013 #include <__cxx03/__functional/unary_function.h>
0014 #include <__cxx03/__fwd/functional.h>
0015 #include <__cxx03/__type_traits/conjunction.h>
0016 #include <__cxx03/__type_traits/invoke.h>
0017 #include <__cxx03/__type_traits/is_constructible.h>
0018 #include <__cxx03/__type_traits/is_enum.h>
0019 #include <__cxx03/__type_traits/underlying_type.h>
0020 #include <__cxx03/__utility/pair.h>
0021 #include <__cxx03/__utility/swap.h>
0022 #include <__cxx03/cstddef>
0023 #include <__cxx03/cstdint>
0024 #include <__cxx03/cstring>
0025
0026 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0027 # pragma GCC system_header
0028 #endif
0029
0030 _LIBCPP_BEGIN_NAMESPACE_STD
0031
0032 template <class _Size>
0033 inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) {
0034 _Size __r;
0035 std::memcpy(&__r, __p, sizeof(__r));
0036 return __r;
0037 }
0038
0039
0040
0041
0042 template <class _Size, size_t = sizeof(_Size) * __CHAR_BIT__>
0043 struct __murmur2_or_cityhash;
0044
0045 template <class _Size>
0046 struct __murmur2_or_cityhash<_Size, 32> {
0047 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
0048 operator()(const void* __key, _Size __len) const {
0049
0050 const _Size __m = 0x5bd1e995;
0051 const _Size __r = 24;
0052 _Size __h = __len;
0053 const unsigned char* __data = static_cast<const unsigned char*>(__key);
0054 for (; __len >= 4; __data += 4, __len -= 4) {
0055 _Size __k = std::__loadword<_Size>(__data);
0056 __k *= __m;
0057 __k ^= __k >> __r;
0058 __k *= __m;
0059 __h *= __m;
0060 __h ^= __k;
0061 }
0062 switch (__len) {
0063 case 3:
0064 __h ^= static_cast<_Size>(__data[2] << 16);
0065 _LIBCPP_FALLTHROUGH();
0066 case 2:
0067 __h ^= static_cast<_Size>(__data[1] << 8);
0068 _LIBCPP_FALLTHROUGH();
0069 case 1:
0070 __h ^= __data[0];
0071 __h *= __m;
0072 }
0073 __h ^= __h >> 13;
0074 __h *= __m;
0075 __h ^= __h >> 15;
0076 return __h;
0077 }
0078 };
0079
0080 template <class _Size>
0081 struct __murmur2_or_cityhash<_Size, 64> {
0082
0083 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK _Size
0084 operator()(const void* __key, _Size __len) const {
0085 const char* __s = static_cast<const char*>(__key);
0086 if (__len <= 32) {
0087 if (__len <= 16) {
0088 return __hash_len_0_to_16(__s, __len);
0089 } else {
0090 return __hash_len_17_to_32(__s, __len);
0091 }
0092 } else if (__len <= 64) {
0093 return __hash_len_33_to_64(__s, __len);
0094 }
0095
0096
0097
0098 _Size __x = std::__loadword<_Size>(__s + __len - 40);
0099 _Size __y = std::__loadword<_Size>(__s + __len - 16) + std::__loadword<_Size>(__s + __len - 56);
0100 _Size __z =
0101 __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, std::__loadword<_Size>(__s + __len - 24));
0102 pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
0103 pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
0104 __x = __x * __k1 + std::__loadword<_Size>(__s);
0105
0106
0107 __len = (__len - 1) & ~static_cast<_Size>(63);
0108 do {
0109 __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1;
0110 __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1;
0111 __x ^= __w.second;
0112 __y += __v.first + std::__loadword<_Size>(__s + 40);
0113 __z = __rotate(__z + __w.first, 33) * __k1;
0114 __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
0115 __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, __y + std::__loadword<_Size>(__s + 16));
0116 std::swap(__z, __x);
0117 __s += 64;
0118 __len -= 64;
0119 } while (__len != 0);
0120 return __hash_len_16(__hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
0121 __hash_len_16(__v.second, __w.second) + __x);
0122 }
0123
0124 private:
0125
0126 static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
0127 static const _Size __k1 = 0xb492b66fbe98f273ULL;
0128 static const _Size __k2 = 0x9ae16a3b2f90404fULL;
0129 static const _Size __k3 = 0xc949d7c7509e6557ULL;
0130
0131 _LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) {
0132 return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
0133 }
0134
0135 _LIBCPP_HIDE_FROM_ABI static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
0136 return (__val >> __shift) | (__val << (64 - __shift));
0137 }
0138
0139 _LIBCPP_HIDE_FROM_ABI static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); }
0140
0141 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size __hash_len_16(_Size __u, _Size __v) {
0142 const _Size __mul = 0x9ddfea08eb382d69ULL;
0143 _Size __a = (__u ^ __v) * __mul;
0144 __a ^= (__a >> 47);
0145 _Size __b = (__v ^ __a) * __mul;
0146 __b ^= (__b >> 47);
0147 __b *= __mul;
0148 return __b;
0149 }
0150
0151 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
0152 __hash_len_0_to_16(const char* __s, _Size __len) {
0153 if (__len > 8) {
0154 const _Size __a = std::__loadword<_Size>(__s);
0155 const _Size __b = std::__loadword<_Size>(__s + __len - 8);
0156 return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
0157 }
0158 if (__len >= 4) {
0159 const uint32_t __a = std::__loadword<uint32_t>(__s);
0160 const uint32_t __b = std::__loadword<uint32_t>(__s + __len - 4);
0161 #ifdef _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION
0162 return __hash_len_16(__len + (static_cast<_Size>(__a) << 3), __b);
0163 #else
0164 return __hash_len_16(__len + (__a << 3), __b);
0165 #endif
0166 }
0167 if (__len > 0) {
0168 const unsigned char __a = static_cast<unsigned char>(__s[0]);
0169 const unsigned char __b = static_cast<unsigned char>(__s[__len >> 1]);
0170 const unsigned char __c = static_cast<unsigned char>(__s[__len - 1]);
0171 const uint32_t __y = static_cast<uint32_t>(__a) + (static_cast<uint32_t>(__b) << 8);
0172 const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
0173 return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
0174 }
0175 return __k2;
0176 }
0177
0178 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
0179 __hash_len_17_to_32(const char* __s, _Size __len) {
0180 const _Size __a = std::__loadword<_Size>(__s) * __k1;
0181 const _Size __b = std::__loadword<_Size>(__s + 8);
0182 const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2;
0183 const _Size __d = std::__loadword<_Size>(__s + __len - 16) * __k0;
0184 return __hash_len_16(
0185 __rotate(__a - __b, 43) + __rotate(__c, 30) + __d, __a + __rotate(__b ^ __k3, 20) - __c + __len);
0186 }
0187
0188
0189
0190 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
0191 __weak_hash_len_32_with_seeds(_Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
0192 __a += __w;
0193 __b = __rotate(__b + __a + __z, 21);
0194 const _Size __c = __a;
0195 __a += __x;
0196 __a += __y;
0197 __b += __rotate(__a, 44);
0198 return pair<_Size, _Size>(__a + __z, __b + __c);
0199 }
0200
0201
0202 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size>
0203 __weak_hash_len_32_with_seeds(const char* __s, _Size __a, _Size __b) {
0204 return __weak_hash_len_32_with_seeds(
0205 std::__loadword<_Size>(__s),
0206 std::__loadword<_Size>(__s + 8),
0207 std::__loadword<_Size>(__s + 16),
0208 std::__loadword<_Size>(__s + 24),
0209 __a,
0210 __b);
0211 }
0212
0213
0214 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static _Size
0215 __hash_len_33_to_64(const char* __s, size_t __len) {
0216 _Size __z = std::__loadword<_Size>(__s + 24);
0217 _Size __a = std::__loadword<_Size>(__s) + (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0;
0218 _Size __b = __rotate(__a + __z, 52);
0219 _Size __c = __rotate(__a, 37);
0220 __a += std::__loadword<_Size>(__s + 8);
0221 __c += __rotate(__a, 7);
0222 __a += std::__loadword<_Size>(__s + 16);
0223 _Size __vf = __a + __z;
0224 _Size __vs = __b + __rotate(__a, 31) + __c;
0225 __a = std::__loadword<_Size>(__s + 16) + std::__loadword<_Size>(__s + __len - 32);
0226 __z += std::__loadword<_Size>(__s + __len - 8);
0227 __b = __rotate(__a + __z, 52);
0228 __c = __rotate(__a, 37);
0229 __a += std::__loadword<_Size>(__s + __len - 24);
0230 __c += __rotate(__a, 7);
0231 __a += std::__loadword<_Size>(__s + __len - 16);
0232 _Size __wf = __a + __z;
0233 _Size __ws = __b + __rotate(__a, 31) + __c;
0234 _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
0235 return __shift_mix(__r * __k0 + __vs) * __k2;
0236 }
0237 };
0238
0239 template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
0240 struct __scalar_hash;
0241
0242 template <class _Tp>
0243 struct __scalar_hash<_Tp, 0> : public __unary_function<_Tp, size_t> {
0244 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
0245 union {
0246 _Tp __t;
0247 size_t __a;
0248 } __u;
0249 __u.__a = 0;
0250 __u.__t = __v;
0251 return __u.__a;
0252 }
0253 };
0254
0255 template <class _Tp>
0256 struct __scalar_hash<_Tp, 1> : public __unary_function<_Tp, size_t> {
0257 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
0258 union {
0259 _Tp __t;
0260 size_t __a;
0261 } __u;
0262 __u.__t = __v;
0263 return __u.__a;
0264 }
0265 };
0266
0267 template <class _Tp>
0268 struct __scalar_hash<_Tp, 2> : public __unary_function<_Tp, size_t> {
0269 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
0270 union {
0271 _Tp __t;
0272 struct {
0273 size_t __a;
0274 size_t __b;
0275 } __s;
0276 } __u;
0277 __u.__t = __v;
0278 return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
0279 }
0280 };
0281
0282 template <class _Tp>
0283 struct __scalar_hash<_Tp, 3> : public __unary_function<_Tp, size_t> {
0284 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
0285 union {
0286 _Tp __t;
0287 struct {
0288 size_t __a;
0289 size_t __b;
0290 size_t __c;
0291 } __s;
0292 } __u;
0293 __u.__t = __v;
0294 return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
0295 }
0296 };
0297
0298 template <class _Tp>
0299 struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> {
0300 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
0301 union {
0302 _Tp __t;
0303 struct {
0304 size_t __a;
0305 size_t __b;
0306 size_t __c;
0307 size_t __d;
0308 } __s;
0309 } __u;
0310 __u.__t = __v;
0311 return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
0312 }
0313 };
0314
0315 struct _PairT {
0316 size_t first;
0317 size_t second;
0318 };
0319
0320 _LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
0321 typedef __scalar_hash<_PairT> _HashT;
0322 const _PairT __p = {__lhs, __rhs};
0323 return _HashT()(__p);
0324 }
0325
0326 template <class _Tp>
0327 struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public __unary_function<_Tp*, size_t> {
0328 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp* __v) const _NOEXCEPT {
0329 union {
0330 _Tp* __t;
0331 size_t __a;
0332 } __u;
0333 __u.__t = __v;
0334 return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
0335 }
0336 };
0337
0338 template <>
0339 struct _LIBCPP_TEMPLATE_VIS hash<bool> : public __unary_function<bool, size_t> {
0340 _LIBCPP_HIDE_FROM_ABI size_t operator()(bool __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0341 };
0342
0343 template <>
0344 struct _LIBCPP_TEMPLATE_VIS hash<char> : public __unary_function<char, size_t> {
0345 _LIBCPP_HIDE_FROM_ABI size_t operator()(char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0346 };
0347
0348 template <>
0349 struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public __unary_function<signed char, size_t> {
0350 _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0351 };
0352
0353 template <>
0354 struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsigned char, size_t> {
0355 _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0356 };
0357
0358 #ifndef _LIBCPP_HAS_NO_CHAR8_T
0359 template <>
0360 struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> {
0361 _LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0362 };
0363 #endif
0364
0365 template <>
0366 struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> {
0367 _LIBCPP_HIDE_FROM_ABI size_t operator()(char16_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0368 };
0369
0370 template <>
0371 struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, size_t> {
0372 _LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0373 };
0374
0375 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
0376 template <>
0377 struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> {
0378 _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0379 };
0380 #endif
0381
0382 template <>
0383 struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> {
0384 _LIBCPP_HIDE_FROM_ABI size_t operator()(short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0385 };
0386
0387 template <>
0388 struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public __unary_function<unsigned short, size_t> {
0389 _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0390 };
0391
0392 template <>
0393 struct _LIBCPP_TEMPLATE_VIS hash<int> : public __unary_function<int, size_t> {
0394 _LIBCPP_HIDE_FROM_ABI size_t operator()(int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0395 };
0396
0397 template <>
0398 struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public __unary_function<unsigned int, size_t> {
0399 _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0400 };
0401
0402 template <>
0403 struct _LIBCPP_TEMPLATE_VIS hash<long> : public __unary_function<long, size_t> {
0404 _LIBCPP_HIDE_FROM_ABI size_t operator()(long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0405 };
0406
0407 template <>
0408 struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public __unary_function<unsigned long, size_t> {
0409 _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
0410 };
0411
0412 template <>
0413 struct _LIBCPP_TEMPLATE_VIS hash<long long> : public __scalar_hash<long long> {};
0414
0415 template <>
0416 struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long> : public __scalar_hash<unsigned long long> {};
0417
0418 #ifndef _LIBCPP_HAS_NO_INT128
0419
0420 template <>
0421 struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> {};
0422
0423 template <>
0424 struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t> : public __scalar_hash<__uint128_t> {};
0425
0426 #endif
0427
0428 template <>
0429 struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> {
0430 _LIBCPP_HIDE_FROM_ABI size_t operator()(float __v) const _NOEXCEPT {
0431
0432 if (__v == 0.0f)
0433 return 0;
0434 return __scalar_hash<float>::operator()(__v);
0435 }
0436 };
0437
0438 template <>
0439 struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> {
0440 _LIBCPP_HIDE_FROM_ABI size_t operator()(double __v) const _NOEXCEPT {
0441
0442 if (__v == 0.0)
0443 return 0;
0444 return __scalar_hash<double>::operator()(__v);
0445 }
0446 };
0447
0448 template <>
0449 struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> {
0450 _LIBCPP_HIDE_FROM_ABI size_t operator()(long double __v) const _NOEXCEPT {
0451
0452 if (__v == 0.0L)
0453 return 0;
0454 #if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__))
0455
0456 union {
0457 long double __t;
0458 struct {
0459 size_t __a;
0460 size_t __b;
0461 size_t __c;
0462 size_t __d;
0463 } __s;
0464 } __u;
0465 __u.__s.__a = 0;
0466 __u.__s.__b = 0;
0467 __u.__s.__c = 0;
0468 __u.__s.__d = 0;
0469 __u.__t = __v;
0470 return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
0471 #elif defined(__x86_64__)
0472
0473 union {
0474 long double __t;
0475 struct {
0476 size_t __a;
0477 size_t __b;
0478 } __s;
0479 } __u;
0480 __u.__s.__a = 0;
0481 __u.__s.__b = 0;
0482 __u.__t = __v;
0483 return __u.__s.__a ^ __u.__s.__b;
0484 #else
0485 return __scalar_hash<long double>::operator()(__v);
0486 #endif
0487 }
0488 };
0489
0490 template <class _Tp, bool = is_enum<_Tp>::value>
0491 struct _LIBCPP_TEMPLATE_VIS __enum_hash : public __unary_function<_Tp, size_t> {
0492 _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT {
0493 typedef typename underlying_type<_Tp>::type type;
0494 return hash<type>()(static_cast<type>(__v));
0495 }
0496 };
0497 template <class _Tp>
0498 struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
0499 __enum_hash() = delete;
0500 __enum_hash(__enum_hash const&) = delete;
0501 __enum_hash& operator=(__enum_hash const&) = delete;
0502 };
0503
0504 template <class _Tp>
0505 struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp> {};
0506
0507 #if _LIBCPP_STD_VER >= 17
0508
0509 template <>
0510 struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t> : public __unary_function<nullptr_t, size_t> {
0511 _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; }
0512 };
0513 #endif
0514
0515 #ifndef _LIBCPP_CXX03_LANG
0516 template <class _Key, class _Hash>
0517 using __check_hash_requirements _LIBCPP_NODEBUG =
0518 integral_constant<bool,
0519 is_copy_constructible<_Hash>::value && is_move_constructible<_Hash>::value &&
0520 __invokable_r<size_t, _Hash, _Key const&>::value >;
0521
0522 template <class _Key, class _Hash = hash<_Key> >
0523 using __has_enabled_hash _LIBCPP_NODEBUG =
0524 integral_constant<bool, __check_hash_requirements<_Key, _Hash>::value && is_default_constructible<_Hash>::value >;
0525
0526 # if _LIBCPP_STD_VER >= 17
0527 template <class _Type, class>
0528 using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
0529
0530 template <class _Type, class... _Keys>
0531 using __enable_hash_helper _LIBCPP_NODEBUG =
0532 __enable_hash_helper_imp<_Type, __enable_if_t<__all<__has_enabled_hash<_Keys>::value...>::value> >;
0533 # else
0534 template <class _Type, class...>
0535 using __enable_hash_helper _LIBCPP_NODEBUG = _Type;
0536 # endif
0537
0538 #endif
0539
0540 _LIBCPP_END_NAMESPACE_STD
0541
0542 #endif