
11 Dec
2007
11 Dec
'07
7 p.m.
Joaquín Mª López Muñoz wrote:
I think unordered containers are *not* allowed to rehash when erasing: see N2461, 23.1.3/8
"...Rehashing invalidates iterators, changes ordering between elements,..."
and 23.1.3/12
"...The erase members shall invalidate only iterators and references to the erased elements."
so the conclusion is that erase can't rehash (incidentally, the implications of rehashing when erasing a range would be difficult to cope with).
If a container implemented a rehash which doesn't invalidate iterators (which is certainly possible, if unlikely) then could it rehash? (Of course, such a container would have to maintain the order of the elements). Daniel