Created on 2017-06-14.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4659.
Edit [string.syn], header <string> synopsis, as indicated:
namespace pmr { template <class charT, class traits = char_traits<charT>> using basic_string = std::basic_string<charT, traits, polymorphic_allocator<charT>>; using string = basic_string<char>; using u16string = basic_string<char16_t>; using u32string = basic_string<char32_t>; using wstring = basic_string<wchar_t>; } // [basic.string.hash], hash support template<class T> struct hash; template<> struct hash<string>; template<> struct hash<u16string>; template<> struct hash<u32string>; template<> struct hash<wstring>; template<> struct hash<pmr::string>; template<> struct hash<pmr::u16string>; template<> struct hash<pmr::u32string>; template<> struct hash<pmr::wstring>;namespace pmr { template <class charT, class traits = char_traits<charT>> using basic_string = std::basic_string<charT, traits, polymorphic_allocator<charT>>; using string = basic_string<char>; using u16string = basic_string<char16_t>; using u32string = basic_string<char32_t>; using wstring = basic_string<wchar_t>; }
Edit [basic.string.hash] as indicated:
template<> struct hash<string>; template<> struct hash<u16string>; template<> struct hash<u32string>; template<> struct hash<wstring>; template<> struct hash<pmr::string>; template<> struct hash<pmr::u16string>; template<> struct hash<pmr::u32string>; template<> struct hash<pmr::wstring>;-1- If S is one of these string types, SV is the corresponding string view type, and s is an object of type S, then hash<S>()(s) == hash<SV>()(SV(s)).
[ 2017-07 Toronto Monday issue prioritization ]
Priority 0; move to Ready
In most cases, std::pmr::meow is a drop-in replacement for std::meow. The exception is std::pmr::{,w,u16,u32}string, because unlike their std:: counterparts, they don't come with enabled std::hash specializations.
The P/R below simply adds std::hash specializations for those four typedefs. An alternative approach, for which wording can be produced if desired, is to make the hash specializations for basic_string allocator-agnostic, similar to the partial specialization of hash for vector<bool>.
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2017-11-13 19:01:36 | admin | set | status: voting -> wp |
2017-10-17 18:34:55 | admin | set | status: ready -> voting |
2017-07-12 01:30:31 | admin | set | messages: + msg9344 |
2017-07-12 01:30:31 | admin | set | status: new -> ready |
2017-06-14 20:24:59 | admin | set | messages: + msg9263 |
2017-06-14 00:00:00 | admin | create |