xte::array<T>::operator=()

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


Definitions

#0
constexpr xte::array<T>& operator=(const xte::array<T>& other) & noexcept(false) requires(/* See below */);
Copies elements from other. If they fit within the uninitialized elements in the current allocation, then reallocation is not performed. Requires that T is copy-constructible and copy-assignable.

#1
constexpr xte::array<T>& operator=(xte::array<T>&& other) & noexcept;
Takes ownership of the underlying data from other, effectively calling .reset() on it.

#2
template<std::ranges::input_range Range>
constexpr xte::array<T>& operator=(Range&& range) & noexcept(false) requires(/* See below */);
Copies qualifiers from Range onto its element type. If Range satisfies std::ranges::sized_range<> and the range's elements fit within the currently allocated uninitialized elements, then reallocation is not performed. Requires that Range is not a reference to xte::array<T> or is derived from it, and T is constructible from the range's elements and is move-assignable.



Example

xte::array array = { 5 };
std::println("{}", 0[array.data());
Output:
5
[View in Compiler Explorer]