|
21 | 21 | #include <__type_traits/is_enum.h> |
22 | 22 | #include <__type_traits/is_floating_point.h> |
23 | 23 | #include <__type_traits/is_integral.h> |
| 24 | +#include <__type_traits/is_unqualified.h> |
24 | 25 | #include <__type_traits/underlying_type.h> |
25 | 26 | #include <__utility/pair.h> |
26 | 27 | #include <__utility/swap.h> |
@@ -355,25 +356,30 @@ struct __hash_impl { |
355 | 356 | }; |
356 | 357 |
|
357 | 358 | template <class _Tp> |
358 | | -struct __hash_impl<_Tp, __enable_if_t<is_enum<_Tp>::value> > : __unary_function<_Tp, size_t> { |
| 359 | +struct __hash_impl<_Tp, __enable_if_t<is_enum<_Tp>::value && __is_unqualified_v<_Tp> > > |
| 360 | + : __unary_function<_Tp, size_t> { |
359 | 361 | _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { |
360 | 362 | using type = __underlying_type_t<_Tp>; |
361 | 363 | return hash<type>()(static_cast<type>(__v)); |
362 | 364 | } |
363 | 365 | }; |
364 | 366 |
|
365 | 367 | template <class _Tp> |
366 | | -struct __hash_impl<_Tp, __enable_if_t<is_integral<_Tp>::value && (sizeof(_Tp) <= sizeof(size_t))> > |
| 368 | +struct __hash_impl< |
| 369 | + _Tp, |
| 370 | + __enable_if_t<is_integral<_Tp>::value && __is_unqualified_v<_Tp> && (sizeof(_Tp) <= sizeof(size_t))> > |
367 | 371 | : __unary_function<_Tp, size_t> { |
368 | 372 | _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { return static_cast<size_t>(__v); } |
369 | 373 | }; |
370 | 374 |
|
371 | 375 | template <class _Tp> |
372 | | -struct __hash_impl<_Tp, __enable_if_t<is_integral<_Tp>::value && (sizeof(_Tp) > sizeof(size_t))> > |
| 376 | +struct __hash_impl<_Tp, |
| 377 | + __enable_if_t<is_integral<_Tp>::value && __is_unqualified_v<_Tp> && (sizeof(_Tp) > sizeof(size_t))> > |
373 | 378 | : __scalar_hash<_Tp> {}; |
374 | 379 |
|
375 | 380 | template <class _Tp> |
376 | | -struct __hash_impl<_Tp, __enable_if_t<is_floating_point<_Tp>::value> > : __scalar_hash<_Tp> { |
| 381 | +struct __hash_impl<_Tp, __enable_if_t<is_floating_point<_Tp>::value && __is_unqualified_v<_Tp> > > |
| 382 | + : __scalar_hash<_Tp> { |
377 | 383 | _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { |
378 | 384 | // -0.0 and 0.0 should return same hash |
379 | 385 | if (__v == 0.0f) |
|
0 commit comments