xte ::array <T >::resize ()
Defined in header <xte/data/array.hpp> Definitions
#0Default-constructs elements at the end while[[nodiscard ]]constexpr void resize (xte ::uz size )& noexcept (false )requires (/* See below */ );
.size () is less than size . Destroys elements at the end while .size () is greater than size . Requires that T is default-constructible.#1
Same as #0 but copy-constructs elements at the end from[[nodiscard ]]constexpr void resize (xte ::uz size ,const T & fill )& noexcept (false )requires (/* See below */ );
fill . Requires that T is copy-constructible.Example
Output:xte ::array array = {1 ,2 ,3 };array .resize (5 );std ::println ("{}" ,array );array .resize (2 );std ::println ("{}" ,array );
[View in Compiler Explorer][1, 2, 3, 0, 0] [1, 2]