This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Hashing standard containers


Hi,
> Unfortunately both TR1 and it looks like C++0x don't provide an
> overload of std::hash for most templated types, including vector,
> list, pair and tuple.
>
> I find this annoying, as (I believe) while it is legal to overload
> std::hash for my own types, it isn't legal to overload it for standard
> types.
>
> I am not sure if technically it is allows as a QoI issue for standard
> libraries to overload std::hash for the standard containers and
> friends, but it does not seem like an unreasonable thing to do, and I
> would like to do it.
You mean, specialize, right? I don't see why it should be illegal. Note,
I just filed DR 1245, will be in R68, because I don't think it makes
sense to pass by value class types. Besides that, which will require
reworking a bit the existing specializations (I'm also thinking moving a
few inline, at least experimentally, people reported a large performance
improvement for <string> if I remember correctly), I would be certainly
interested in seeing such additional specializations, C++0x only please,
let's try to fiddle as little as possible with TR1 at this point. I
would definitely suggest starting with the mandated ones, thus
std::bitset, and std::vector<bool>...

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]