Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit 68cc668162.
PrevUpHomeNext
array::resize (2 of 2 overloads)

Change the number of elements stored.

Synopsis
void
resize(
    std::size_t count,
    value const& v);
Description

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.

Complexity

Linear in abs(size() - count), plus the cost of reallocation if capacity() is less than count.

Exception Safety

Strong guarantee. Calls to memory_resource::allocate may throw.

Parameters

Name

Description

count

The new size of the container.

v

The value to copy into the new elements.


PrevUpHomeNext