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

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


Definition

constexpr void reserve_total(xte::uz total) & noexcept(false) requires(/* See below */);
Reallocates with a total amount of space. If total is not greater than .capacity(), 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_total(3);
std::println("{}", array.capacity());
Possible output:
16
16
[View in Compiler Explorer]