Rakesh Kumar wrote:
I am going through the STL API for std::string.
I see 2 methods called reserve(sz) and resize(sz) .
I am just curious if they actually implement the same and if not ,
Not.
what are the scenarios in which one would be preferable over another.
'resize' changes the size. 'reserve' changes the capacity (so that
some growth didn't require reallocation. 'reserve' does not change
the size. They mean (and do) different things. Use each one when
appropriate.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask