Skip to content

ludus::foundation::core::StaticArray

Ludus Wiki · API overview · Browse API

Struct

Fixed-size owning aggregate; no allocation. Element count is a compile-time constant. Bounds and nonempty element access are caller preconditions.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

#include <ludus/foundation/containers/static_array.hpp>
template <typename ElementType, usize Count>
struct ludus::foundation::core::StaticArray

Types

ValueType

using ludus::foundation::core::StaticArray< ElementType, Count >::ValueType = ElementType
Stored element type.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

SizeType

using ludus::foundation::core::StaticArray< ElementType, Count >::SizeType = usize
Size and index type.

Related types: usize

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Iterator

using ludus::foundation::core::StaticArray< ElementType, Count >::Iterator = ElementType*
Contiguous mutable iterator into the inline storage.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

ConstIterator

using ludus::foundation::core::StaticArray< ElementType, Count >::ConstIterator = const ElementType*
Contiguous read-only iterator into the inline storage.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Fields

mData

ElementType ludus::foundation::core::StaticArray< ElementType, Count >::mData[Count][Count]
Aggregate storage for Count live elements; prefer the indexed accessors.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Static methods

GetSize

static constexpr usize ludus::foundation::core::StaticArray< ElementType, Count >::GetSize() noexcept
Element count; always Count.

Related types: usize

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

GetCapacity

static constexpr usize ludus::foundation::core::StaticArray< ElementType, Count >::GetCapacity() noexcept
Capacity; always Count, because every element is live.

Related types: usize

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

IsEmpty

static constexpr bool ludus::foundation::core::StaticArray< ElementType, Count >::IsEmpty() noexcept
True only when Count is 0 (handled by the zero-size specialization).

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

size

static constexpr usize ludus::foundation::core::StaticArray< ElementType, Count >::size() noexcept
Standard interop spelling of GetSize().

Related types: usize

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Methods

GetData

constexpr ElementType * ludus::foundation::core::StaticArray< ElementType, Count >::GetData() noexcept
First element of the inline storage; valid for the array's lifetime.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

GetData

constexpr const ElementType * ludus::foundation::core::StaticArray< ElementType, Count >::GetData() const noexcept
Read-only first element of the inline storage.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

operator[]

constexpr ElementType & ludus::foundation::core::StaticArray< ElementType, Count >::operator[](usize index) noexcept
Element at index.

Precondition

index < Count (asserted in checked builds).

Related types: usize

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

operator[]

constexpr const ElementType & ludus::foundation::core::StaticArray< ElementType, Count >::operator[](usize index) const noexcept
Read-only element at index.

Precondition

index < Count (asserted in checked builds).

Related types: usize

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

GetFirst

constexpr ElementType & ludus::foundation::core::StaticArray< ElementType, Count >::GetFirst() noexcept
First element.

Precondition

Count > 0.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

GetFirst

constexpr const ElementType & ludus::foundation::core::StaticArray< ElementType, Count >::GetFirst() const noexcept
Read-only first element.

Precondition

Count > 0.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

GetLast

constexpr ElementType & ludus::foundation::core::StaticArray< ElementType, Count >::GetLast() noexcept
Last element.

Precondition

Count > 0.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

GetLast

constexpr const ElementType & ludus::foundation::core::StaticArray< ElementType, Count >::GetLast() const noexcept
Read-only last element.

Precondition

Count > 0.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

begin

constexpr Iterator ludus::foundation::core::StaticArray< ElementType, Count >::begin() noexcept
Range-for/standard interop: first element.

Related types: Iterator

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

begin

constexpr ConstIterator ludus::foundation::core::StaticArray< ElementType, Count >::begin() const noexcept
Range-for/standard interop: read-only first element.

Related types: ConstIterator

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

cbegin

constexpr ConstIterator ludus::foundation::core::StaticArray< ElementType, Count >::cbegin() const noexcept
Standard interop: read-only first element.

Related types: ConstIterator

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

end

constexpr Iterator ludus::foundation::core::StaticArray< ElementType, Count >::end() noexcept
Range-for/standard interop: one past the last element.

Related types: Iterator

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

end

constexpr ConstIterator ludus::foundation::core::StaticArray< ElementType, Count >::end() const noexcept
Range-for/standard interop: read-only one past the last element.

Related types: ConstIterator

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

cend

constexpr ConstIterator ludus::foundation::core::StaticArray< ElementType, Count >::cend() const noexcept
Standard interop: read-only one past the last element.

Related types: ConstIterator

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

data

constexpr ElementType * ludus::foundation::core::StaticArray< ElementType, Count >::data() noexcept
Standard interop spelling of GetData().

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

data

constexpr const ElementType * ludus::foundation::core::StaticArray< ElementType, Count >::data() const noexcept
Standard interop spelling of the read-only GetData().

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Fill

constexpr void ludus::foundation::core::StaticArray< ElementType, Count >::Fill(const ElementType &value)
Copy-assign value to every element. value may refer to an element of this array.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Swap

constexpr void ludus::foundation::core::StaticArray< ElementType, Count >::Swap(StaticArray &other)
Swap element-by-element with other using ADL swap.
O(Count); element addresses do not move, their values do.

Related types: StaticArray

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

operator std::span\< ElementType >

constexpr ludus::foundation::core::StaticArray< ElementType, Count >::operator std::span< ElementType >() noexcept
Borrow all Count elements as a mutable span.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

operator std::span\< const ElementType >

constexpr ludus::foundation::core::StaticArray< ElementType, Count >::operator std::span< const ElementType >() const noexcept
Borrow all Count elements as a read-only span.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

AsSpan

constexpr std::span< ElementType > ludus::foundation::core::StaticArray< ElementType, Count >::AsSpan() noexcept
Mutable span over all Count elements.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

AsSpan

constexpr std::span< const ElementType > ludus::foundation::core::StaticArray< ElementType, Count >::AsSpan() const noexcept
Read-only span over all Count elements.

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

Members

operator==

constexpr bool operator==(const StaticArray &, const StaticArray &)=default
Element-wise equality.

Related types: StaticArray

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp

operator\<=>

constexpr auto operator<=>(const StaticArray &, const StaticArray &)=default
Lexicographic element-wise ordering; requires ordered elements.

Related types: StaticArray

Declared in modules/foundation/containers/include/ludus/foundation/containers/static_array.hpp