Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template overhead (_M_realloc_insert, _M_default_append) when size is known at initialization but not at compile time.
More...
|
| | FixedVector ()=default |
| |
| | FixedVector (std::initializer_list< T > init_list) |
| | Constructor from initializer list - allocates exact size needed This enables brace initialization: FixedVector<int> v = {1, 2, 3};.
|
| |
| | ~FixedVector () |
| |
| | FixedVector (const FixedVector &)=delete |
| |
| FixedVector & | operator= (const FixedVector &)=delete |
| |
| | FixedVector (FixedVector &&other) noexcept |
| |
| FixedVector & | operator= (FixedVector &&other) noexcept |
| |
| FixedVector & | operator= (std::initializer_list< T > init_list) |
| | Assignment from initializer list - avoids temporary and move overhead This enables: FixedVector<int> v; v = {1, 2, 3};.
|
| |
| void | init (size_t n) |
| |
| void | clear () |
| |
| void | shrink_to_fit () |
| |
| void | push_back (const T &value) |
| | Add element without bounds checking Caller must ensure sufficient capacity was allocated via init() Silently ignores pushes beyond capacity (no exception or assertion)
|
| |
| void | push_back (T &&value) |
| | Add element by move without bounds checking Caller must ensure sufficient capacity was allocated via init() Silently ignores pushes beyond capacity (no exception or assertion)
|
| |
| template<typename... Args> |
| T & | emplace_back (Args &&...args) |
| | Emplace element without bounds checking - constructs in-place with arguments Caller must ensure sufficient capacity was allocated via init() Returns reference to the newly constructed element NOTE: Caller MUST ensure size_ < capacity_ before calling.
|
| |
| T & | front () |
| | Access first element (no bounds checking - matches std::vector behavior) Caller must ensure vector is not empty (size() > 0)
|
| |
| const T & | front () const |
| |
| T & | back () |
| | Access last element (no bounds checking - matches std::vector behavior) Caller must ensure vector is not empty (size() > 0)
|
| |
| const T & | back () const |
| |
| size_t | size () const |
| |
| bool | empty () const |
| |
| T & | operator[] (size_t i) |
| | Access element without bounds checking (matches std::vector behavior) Caller must ensure index is valid (i < size())
|
| |
| const T & | operator[] (size_t i) const |
| |
| T & | at (size_t i) |
| | Access element with bounds checking (matches std::vector behavior) Note: No exception thrown on out of bounds - caller must ensure index is valid.
|
| |
| const T & | at (size_t i) const |
| |
| T * | begin () |
| |
| T * | end () |
| |
| const T * | begin () const |
| |
| const T * | end () const |
| |
template<typename T>
class esphome::FixedVector< T >
Fixed-capacity vector - allocates once at runtime, never reallocates This avoids std::vector template overhead (_M_realloc_insert, _M_default_append) when size is known at initialization but not at compile time.
Definition at line 167 of file helpers.h.