Engine → Core → stable_vector.h
stable_vector
| Type | Class |
| Namespace | conjure::core |
| Include File Path | engine/include/conjure/core/containers/stable_vector.h |
| Source File Path | N/A |
| API ↗ | Containers |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | stable_vector() = default; | |
| public | stable_vector(
const stable_vector &other); | |
| public | stable_vector(
stable_vector &&other) noexcept; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~stable_vector(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | CHUNK_SIZE | static constexpr usize | ChunkSize | Elements per chunk. |
| private | mChunks | std::vector<T *> | {} | |
| private | mSize | usize | 0 |
Functions
Public
at
at[[nodiscard]] T &at(
usize index) noexcept;Bounds-checked access in every configuration. An out-of-range index is a fatal programmer error (asserts, then terminates), never an exception.
[[nodiscard]] const T &at(
usize index) const noexcept;back
back[[nodiscard]] T &back() noexcept;[[nodiscard]] const T &back() const noexcept;cbegin
cbegin[[nodiscard]] const_iterator cbegin() const noexcept;cend
cend[[nodiscard]] const_iterator cend() const noexcept;chunk_count
chunk_count[[nodiscard]] usize chunk_count() const noexcept;emplace_back
emplace_backtemplate <typename... Args> T &emplace_back(
Args &&...args);Constructs an element at the end and returns a reference that stays valid until the element is destroyed (pop_back, clear, destruction). Never moves other elements.
empty
empty[[nodiscard]] bool empty() const noexcept;front
front[[nodiscard]] T &front() noexcept;[[nodiscard]] const T &front() const noexcept;pop_back
pop_backvoid pop_back() noexcept;Destroys the last element. Asserts when empty. Chunks are kept.
push_back
push_backT &push_back(
const T &value);T &push_back(
T &&value);reserve
reservevoid reserve(
usize count);Allocates chunks so that count elements fit without further allocation.
shrink_to_fit
shrink_to_fitvoid shrink_to_fit() noexcept;Frees chunks that hold no element.
size
size[[nodiscard]] usize size() const noexcept;Private
allocate_chunk
allocate_chunk[[nodiscard]] static T *allocate_chunk();deallocate_chunk
deallocate_chunkstatic void deallocate_chunk(
T *chunk) noexcept;release_chunks
release_chunksvoid release_chunks() noexcept;slot_at
slot_at[[nodiscard]] T *slot_at(
usize index) const noexcept;Operator Overloads
Public
operator=
operator=stable_vector &operator=(
const stable_vector &other);stable_vector &operator=(
stable_vector &&other) noexcept;