xte::fixed_array {}

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

A fixed-size array.


Definition

template<typename T, xte::uz n>
struct fixed_array {
	using size_type = xte::uz;
	using difference_type = xte::iptrdiff;
	using value_type = T;
	using reference = T&;
	using const_reference = const T&;
	using pointer = T*;
	using const_pointer = const T*;
	using iterator = T*;
	using const_iterator = const T*;
	using reverse_iterator = std::reverse_iterator<T*>;
	using const_reverse_iterator = std::reverse_iterator<const T*>;

	/* [:^^T[n]:] _data; */

	constexpr auto* data(this auto&&) noexcept;

	static constexpr auto size = xte::wrap_value<n>();

	template<xte::uz m>
	friend constexpr auto operator<=>(const xte::fixed_array<T, n>&, const xte::fixed_array<T, m>&) XTE_ARROW(/* ... */)

	template<xte::uz m>
	friend constexpr auto operator==(const xte::fixed_array<T, n>&, const xte::fixed_array<T, m>&) XTE_ARROW(/* ... */)

	constexpr auto* begin(this auto&&) noexcept;
	
	constexpr const T* cbegin() const noexcept;

	constexpr auto* end(this auto&&) noexcept;
	
	constexpr const T* cend() const noexcept;

	constexpr auto rbegin(this auto&&) noexcept;

	constexpr auto crbegin() const noexcept;

	constexpr auto rend(this auto&&) noexcept;

	constexpr auto crend() const noexcept;

	constexpr auto&& front(this auto&&, xte::uz) noexcept;

	constexpr auto&& back(this auto&&, xte::uz) noexcept;

	constexpr auto&& operator[](this auto&&, xte::uz) noexcept;

	template<xte::uz index>
	constexpr auto&& get(this auto&&) noexcept;

	template<typename Rhs>
	requires(/* ... */)
	constexpr auto operator+(this auto&&, Rhs&&) XTE_ARROW(/* ... */)
};


Deduction guide

template<typename T, typename... Ts>
fixed_array(T&, Ts&&...) -> fixed_array<std::common_type_t<T, Ts...>, -~sizeof...(Ts)>;


Specializations for structured binding

template<typename T, xte::uz n>
struct std::tuple_size<xte::fixed_array<T, n>>;

template<xte::uz index, typename T, xte::uz n>
struct std::tuple_element<index, xte::fixed_array<T, n>>;



Example

xte::fixed_array array = { 1, 2, 3 };
std::println("{}", array);
Output:
[1, 2, 3]
[View in Compiler Explorer]