@@ -917,6 +917,12 @@ constexpr size_t _Traits_rfind_not_ch(_In_reads_(_Hay_size) const _Traits_ptr_t<
917
917
return static_cast<size_t>(-1); // no match
918
918
}
919
919
920
+ template <class _Ty>
921
+ _INLINE_VAR constexpr bool _Is_EcharT = _Is_any_of_v<_Ty, char, wchar_t,
922
+ #ifdef __cpp_char8_t
923
+ char8_t,
924
+ #endif // __cpp_char8_t
925
+ char16_t, char32_t>;
920
926
921
927
#if _HAS_CXX17
922
928
template <class _Elem, class _Traits = char_traits<_Elem>>
@@ -1824,12 +1830,9 @@ using u32string_view = basic_string_view<char32_t>;
1824
1830
using wstring_view = basic_string_view<wchar_t>;
1825
1831
1826
1832
1827
- template <class _Elem, class _Traits>
1828
- struct hash<basic_string_view<_Elem, _Traits>> {
1829
- _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef basic_string_view<_Elem, _Traits> _ARGUMENT_TYPE_NAME;
1830
- _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t _RESULT_TYPE_NAME;
1831
-
1832
- _NODISCARD size_t operator()(const basic_string_view<_Elem, _Traits> _Keyval) const noexcept {
1833
+ template <class _Elem>
1834
+ struct hash<basic_string_view<_Elem>> : _Conditionally_enabled_hash<basic_string_view<_Elem>, _Is_EcharT<_Elem>> {
1835
+ _NODISCARD static size_t _Do_hash(const basic_string_view<_Elem> _Keyval) noexcept {
1833
1836
return _Hash_array_representation(_Keyval.data(), _Keyval.size());
1834
1837
}
1835
1838
};
@@ -5191,12 +5194,10 @@ using u8string = basic_string<char8_t, char_traits<char8_t>, allocator<char8_t>>
5191
5194
using u16string = basic_string<char16_t, char_traits<char16_t>, allocator<char16_t>>;
5192
5195
using u32string = basic_string<char32_t, char_traits<char32_t>, allocator<char32_t>>;
5193
5196
5194
- template <class _Elem, class _Traits, class _Alloc>
5195
- struct hash<basic_string<_Elem, _Traits, _Alloc>> {
5196
- _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef basic_string<_Elem, _Traits, _Alloc> _ARGUMENT_TYPE_NAME;
5197
- _CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t _RESULT_TYPE_NAME;
5198
-
5199
- _NODISCARD size_t operator()(const basic_string<_Elem, _Traits, _Alloc>& _Keyval) const noexcept {
5197
+ template <class _Elem, class _Alloc>
5198
+ struct hash<basic_string<_Elem, char_traits<_Elem>, _Alloc>>
5199
+ : _Conditionally_enabled_hash<basic_string<_Elem, char_traits<_Elem>, _Alloc>, _Is_EcharT<_Elem>> { // per LWG-3705
5200
+ _NODISCARD static size_t _Do_hash(const basic_string<_Elem, char_traits<_Elem>, _Alloc>& _Keyval) noexcept {
5200
5201
return _Hash_array_representation(_Keyval.c_str(), _Keyval.size());
5201
5202
}
5202
5203
};
0 commit comments