array::resize
Change the number of elements stored.
Synopsis
void
resize(
std::size_t count); (1)
void
resize(
std::size_t count,
value const& jv); (2)
Description
Resizes the container to contain count elements.
-
If
size() > count, the container is reduced to its firstcountelements. -
If
size() < count, additional null values ((1)) or copies ofjv((2)) are appended.
If capacity() < count, a reallocation occurs first, and all iterators and references are invalidated. Any past-the-end iterators are always invalidated.
Complexity
Linear in size() + count.
Exception Safety
Strong guarantee. Calls to memory_resource::allocate may throw.
Parameters
| Name | Description |
|---|---|
|
The new size of the container. |
|
The |