This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
std::hash
specializations for std::bitset/std::vector<bool>
Section: 22.10.19 [unord.hash] Status: CD1 Submitter: Thorsten Ottosen Opened: 2008-06-05 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [unord.hash].
View all issues with CD1 status.
Discussion:
In the current working draft, std::hash<T>
is specialized for builtin
types and a few other types. Bitsets seems like one that is missing from
the list, not because it cannot not be done by the user, but because it
is hard or impossible to write an efficient implementation that works on
32bit/64bit chunks at a time. For example, std::bitset
is too much
encapsulated in this respect.
Proposed resolution:
Add the following to the synopsis in 22.10 [function.objects]/2:
template<class Allocator> struct hash<std::vector<bool,Allocator>>; template<size_t N> struct hash<std::bitset<N>>;
Modify the last sentence of 22.10.19 [unord.hash]/1 to end with:
... and
std::string
,std::u16string
,std::u32string
,std::wstring
,std::error_code
,std::thread::id
,std::bitset
,and std::vector<bool>
.