Re: std::vector memory allocation
onion> When a std::vector has to allocate more memory, am I correct in
onion> thinking that it allocates additional memory of equal size to
onion> the amount of memory required to store the existing number of
There is no particular requirement on how much memory to allocate,
except that the strategy must be such that it offers amortized
constant time for appending an element. Increasing the existing space
by any positive constant multiple is enough to meet that requirement.
There are other strategies that work too.
|All times are GMT. The time now is 04:13 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.