-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!
Description
Per the standard, the specializations:
template<> struct hash<string>;
template<> struct hash<u8string>;
template<> struct hash<u16string>;
template<> struct hash<u32string>;
template<> struct hash<wstring>;
template<> struct hash<pmr::string>;
template<> struct hash<pmr::u8string>;
template<> struct hash<pmr::u16string>;
template<> struct hash<pmr::u32string>;
template<> struct hash<pmr::wstring>;
template<> struct hash<string_view>;
template<> struct hash<u8string_view>;
template<> struct hash<u16string_view>;
template<> struct hash<u32string_view>;
template<> struct hash<wstring_view>;
Should be enabled, and all other specializations of hash
for specializations of basic_string_view
/ basic_string
should be disabled. We currently enable hash
for all specializations of basic_string_view
:
Lines 1715 to 1724 in 852a308
// STRUCT TEMPLATE SPECIALIZATION hash FOR basic_string_view | |
template <class _Elem, class _Traits> | |
struct hash<basic_string_view<_Elem, _Traits>> { | |
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef basic_string_view<_Elem, _Traits> _ARGUMENT_TYPE_NAME; | |
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t _RESULT_TYPE_NAME; | |
_NODISCARD size_t operator()(const basic_string_view<_Elem, _Traits> _Keyval) const noexcept { | |
return _Hash_array_representation(_Keyval.data(), _Keyval.size()); | |
} | |
}; |
and basic_string
:
Lines 4579 to 4588 in 852a308
// STRUCT TEMPLATE SPECIALIZATION hash | |
template <class _Elem, class _Traits, class _Alloc> | |
struct hash<basic_string<_Elem, _Traits, _Alloc>> { | |
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef basic_string<_Elem, _Traits, _Alloc> _ARGUMENT_TYPE_NAME; | |
_CXX17_DEPRECATE_ADAPTOR_TYPEDEFS typedef size_t _RESULT_TYPE_NAME; | |
_NODISCARD size_t operator()(const basic_string<_Elem, _Traits, _Alloc>& _Keyval) const noexcept { | |
return _Hash_array_representation(_Keyval.c_str(), _Keyval.size()); | |
} | |
}; |
Additional Context
Skipped libcxx test
STL/tests/libcxx/expected_results.txt
Lines 640 to 642 in 06827fe
# STL bug: GH-757 <xstring>: Too many enabled hash specializations | |
std/strings/basic.string.hash/char_type_hash.fail.cpp FAIL | |
std/strings/string.view/string.view.hash/char_type.hash.fail.cpp FAIL |
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!