STL question

Joe Buck
Mon Sep 28 09:26:00 GMT 1998

Alexandre Oliva writes:

> Unlike map, hash_map does not support insert(pos,x), so insert
> iterators do not work on it :-(

I think that this is a design bug.  STL containers should be as orthogonal
as possible.  (and since hash_map is an extension, it can be fixed without
having to worry about violating the standard.

> Perhaps insert iterators should be specialized for hash maps...

Or perhaps insert(iterator, value) should be implemented for hash maps,
in an analogous way as for maps (the iterator position is only taken as
a hint, which can be ignored if necessary).

More information about the Gcc mailing list