...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Change the number of elements stored.
void resize( std::size_t count);
Resizes the container to contain count
elements. If capacity() < size() + count
,
a reallocation occurs first, and all iterators and references are invalidated.
Any past-the-end iterators are always invalidated.
size()
> count
,
the container is reduced to its first count
elements.
size()
< count
,
additional null values are appended.
Linear in abs(size() - count)
, plus the cost of reallocation if capacity()
is less than count
.
Strong guarantee. Calls to memory_resource::allocate
may throw.
Name |
Description |
---|---|
|
The new size of the container. |