C++ Logo

std-discussion

Advanced search

std::hash

From: Marcin Jaczewski <marcinjaczewski86_at_[hidden]>
Date: Fri, 24 Mar 2023 22:14:37 +0100
I recently looked at `std::unordered_map` and noticed a bit of a
bizarre handling of `std::hash` in the standard library.
Why of all types that could be useful, does the standard define only
`std::vector<bool>`?
Where `std::tuple` or other vectors are left unusable.

What is the reason for standard not defining
`std::hash<std::vector<T>>` if `T` has a hash?
And why is `bool` the only exception there? What was the motivation for this?
https://eel.is/c++draft/vector.bool#pspc-7

Received on 2023-03-24 21:14:50