ZXFoundation™ 26h2
Loading...
Searching...
No Matches
lib.static_vector Module Reference

Data Structures

struct  lib::format::formatter< lib::static_vector< T, N > >
 Formatter for lib::static_vector<T, N>. More...
class  lib::static_vector< T, N >
 A contiguous sequence of up to N elements stored entirely. More...

Typedefs

using const_iterator = const T*
using const_pointer = const T*
using const_reference = const T&
using iterator = T*
using pointer = T*
using reference = T&
using size_type = usize
using value_type = T

Functions

auto as_span () const noexcept -> std::span< const T >
auto as_span () noexcept -> std::span< T >
 Non-owning view over the live elements.
auto back () const noexcept -> const T &
auto back () noexcept -> T &
auto begin () const noexcept -> const_iterator
auto begin () noexcept -> iterator
constexpr auto capacity () const noexcept -> usize
 Maximum number of elements.
auto clear () noexcept -> void
 Destroy all elements; size becomes 0.
auto data () const noexcept -> const T *
auto data () noexcept -> T *
template<typename... Args>
auto emplace_back (Args &&... args) noexcept -> std::expected< T *, lib::kernel_error >
 Construct element in-place at the end.
constexpr auto empty () const noexcept -> bool
 True when size() == 0.
auto end () const noexcept -> const_iterator
auto end () noexcept -> iterator
auto format (format_context &ctx, const lib::static_vector< T, N > &v) const noexcept -> void
auto front () const noexcept -> const T &
auto front () noexcept -> T &
constexpr auto full () const noexcept -> bool
 True when size() == capacity().
auto operator= (const static_vector &o) noexcept -> static_vector &
auto operator= (static_vector &&o) noexcept -> static_vector &
auto operator[] (usize i) const noexcept -> const T &
auto operator[] (usize i) noexcept -> T &
auto pop_back () noexcept -> void
 Remove and destroy the last element.
auto push_back (const T &val) noexcept -> std::expected< void, lib::kernel_error >
 Append a copy of val.
auto push_back (T &&val) noexcept -> std::expected< void, lib::kernel_error >
 Append by moving val.
auto push_back_unchecked (const T &val) noexcept -> void
 Unchecked push — caller guarantees !full().
auto push_back_unchecked (T &&val) noexcept -> void
constexpr auto size () const noexcept -> usize
 Number of live elements.
constexpr static_vector () noexcept=default
 Default constructor — empty vector.
 static_vector (const static_vector &o)
 Copy constructor.
 static_vector (static_vector &&o)
 Move constructor.
 ~static_vector () noexcept
 Destructor — destroys all live elements.

Variables

static constexpr usize capacity_v = N

Files

file  lib/static_vector.cxxm
 Fixed-capacity growable array with inline storage — no heap.