xte::array<T>::reserve()

Defined in header <xte/data/array.hpp>


Definition

constexpr void reserve(xte::uz additional = 1) & noexcept(false) requires(/* See below */);
Reallocates with additional space. If additional is zero, this has no effect. If allocation fails, the object remains unchanged. Requires that T is constructible from itself through std::move_if_noexcept().



Example

xte::array array = { 1, 2, 3 };
std::println("{}", array.capacity());
array.reserve(3);
std::println("{}", array.capacity());
Possible output:
16
24
[View in Compiler Explorer]