Hello,
When calling 'x.reserve(n)' for an unordered container I'd expect to
be able to insert n elements without invalidating iterators. But as
the standard is written, the guarantee only holds for n-1 elements.
For a container with max_load_factor of 1, reserve(n) is equivalent to
rehash(ceil(n/1)), which is rehash(n). rehash(n) requires that the
bucket count is >= n, so it can be n. The rule is that insert shall
not affect the validity of iterators if (N + n) < z * B. But for this
case the two sides of the equation are equal, so insert can affect the
validity of iterators. Is that a mistake?
Daniel
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:
std-cpp...@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ:
http://www.comeaucomputing.com/csc/faq.html ]