Template Class FixedSizeContainer
Defined in File fixed_size_container.hpp
Nested Relationships
Nested Types
Class Documentation
-
template<typename T, uint32_t capacity = 1U>
class FixedSizeContainer allows allocating a predefined capacity of T objects on the stack and using there pointers outside (pointers stay valid until object is removed from theFixedSizeContainer) therefore we avoid heap allocation but we can still use pointers to objects for efficient update/passing until we exhaust the fixed size container
- Attention
no bounds checking during access for efficiency (as in STL containers) access to indices < 0 or >= capacity is undefined behaviour (most likely a segmentation fault)
Public Functions
-
inline FixedSizeContainer() noexcept
-
inline Index_t add(const T &element) noexcept
Note
returns index or -1 if element could not be added a successful add returns an arbitrary index which can be non consecutive for consecutive adds
-
inline T &operator[](Index_t index) noexcept
Note
access can change the underlying object, without modifying valid flag if the index is invalid than the behavior is undefined
-
inline size_t size() noexcept
Public Static Attributes
-
static constexpr int32_t NOT_AN_ELEMENT = -1