xte ::array <T >::insert ()
Defined in header <xte/data/array.hpp> Definitions
#0Default-constructs an element at the given index, shifting existing elements back. Requires thatconstexpr void insert (xte ::uz index )& noexcept (false )requires (/* See below */ );
T is default-constructible and move-assignable.#1
Constructs an element at the given index with the provided arguments, shifting existing elements back. Requires thattemplate <typename U =T >constexpr void insert (xte ::uz index ,U && arg ,auto&&... args )& noexcept (false )requires (/* See below */ );
T is constructible from the provided args and is move-assignable.Examples
#0Output:xte ::array array = {1 ,2 ,3 };array .insert (1 );std ::println ("{}" ,array );
[View in Compiler Explorer][1, 0, 2, 3]
#1
Output:xte ::array <xte ::array <int >>array = { {1 ,2 ,3 }, {4 ,5 ,6 }, {7 ,8 ,9 } };array .insert (1 , {111 ,222 ,333 });std ::println ("{}" ,array );
[View in Compiler Explorer][[1, 2, 3], [111, 222, 333], [4, 5, 6], [7, 8, 9]]