Skip to content

Engine → Core

small_vector.h

small_vector: a std::vector with inline storage for the first N elements.

Classes

File Description
small_vector

Type Aliases

small_vector::const_iterator

using const_iterator = const T *;

small_vector::const_pointer

using const_pointer = const T *;

small_vector::const_reference

using const_reference = const T &;

small_vector::const_reverse_iterator

using const_reverse_iterator = std::reverse_iterator<const_iterator>;

small_vector::difference_type

using difference_type = isize;

small_vector::iterator

using iterator = T *;

small_vector::pointer

using pointer = T *;

small_vector::reference

using reference = T &;

small_vector::reverse_iterator

using reverse_iterator = std::reverse_iterator<iterator>;

small_vector::size_type

using size_type = usize;

small_vector::value_type

using value_type = T;

Unions

small_vector::inline_storage

union inline_storage {
    T elements[N];

    inline_storage() noexcept {}
    ~inline_storage() {}

    inline_storage(const inline_storage &) = delete;
    inline_storage &operator=(const inline_storage &) = delete;
};

Raw inline storage. A union keeps the natural alignment of T without an alignas specifier and never constructs the elements itself.

Functions

Public

swap

template <typename T, usize N> void swap(
    small_vector<T, N> &left,
    small_vector<T, N> &right) noexcept;