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