Jorgen Grahn said:
But upthread people pointed out that the method doesn't have to do
anything /at all/ -- surely that's a strong hint that it is misnamed?
It's a hint that the standard gives some breathing room for
implementors when warranted (such as the reserved space for vectors,
whose existance isn't directly observable).
That doesn't mean implementors should do dumb things when there's no
reason to -- it seems fairly obvious what behavior is expected in
"conventional" environments.
[Note that it's trivial for user code to do something like:
"if (...) v.shrink_to_fit()", to establish more refined behavior.]
In that case I'd prefer a method called unreserve(size_type) or
something -- if I have to do the work myself, I also want the full
control.
So when you release your standard, it'll be called that... :]
[Though "do the work myself" seems a bit overstated -- a simple "if
(comparison)..." isn't a huge burden...]
As I mentioned elsewhere, this particular method seems to basically be
the committee's "OK, OK" response to complaints that performing this
often-wanted operation ("get rid of all the extra reserved space now
that I've finished filling in my vector") was clumsy in the old
standard.
My impression is that it wasn't really carefully thought out as a
general tool, just as a practical answer to those complaints. No
doubt it's possible to replace it with something more elegant and
general -- but who knows if it's worth the trouble...
-miles