| Home | Libraries | People | FAQ | More

###### array::resize (1 of 2 overloads)

Change the number of elements stored.

<h7> Synopsis </h7>

    void
    resize(
        std::size_t count);

<h7> Description </h7>

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.

- If `size() > count`, the container is reduced to its first `count` elements.
- If `size() < count`, additional null values are appended.

<h7> Complexity </h7>

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

<h7> Exception Safety </h7>

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

<h7> Parameters </h7>

Name | Description
--- | ---
`count` | The new size of the container.