Title
Missing std::hash specializations for std::bitset/std::vector<bool>
Status
cd1
Section
[unord.hash]
Submitter
Thorsten Ottosen

Created on 2008-06-05.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Add the following to the synopsis in [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 [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>.

Date: 2008-06-05.00:00:00

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.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4039
2008-06-05 00:00:00admincreate