|
ESPHome 2026.11.0b6
|
Owning variant: a codegen table that outlives it, or a heap copy of a runtime list it owns. More...
#include <helpers.h>
Public Types | |
| using | value_type = T |
Public Member Functions | |
| constexpr | ConstVector ()=default |
| constexpr | ConstVector (const T *data, size_t size) |
| ConstVector (const ConstVector &)=delete | |
| ConstVector & | operator= (const ConstVector &)=delete |
| ~ConstVector () | |
| const T * | begin () const |
| const T * | end () const |
| const T * | data () const |
| size_t | size () const |
| bool | empty () const |
| const T & | operator[] (size_t index) const |
| const T & | at (size_t index) const |
| void | assign_static (const T *data, size_t size) |
| Codegen only: call before any runtime copy; it does not free a previous owned copy (generated setup() runs before any lambda or automation can call set_options). | |
| void | append_copy (const T *extra, size_t count) |
| Appends count elements into one new heap array this owns; the current list and extra may be codegen tables in flash. | |
| void | prepend_copy (const T *extra, size_t count) |
| Like append_copy(), with extra placed in front of the current list. | |
| void | assign_copy (const T *data, size_t size) |
| Copies the list into a heap array this owns, freeing a previous owned copy. | |
Protected Member Functions | |
| void | release_ () |
| void | merge_copy_ (const T *first, size_t first_count, const T *second, size_t second_count) |
Static Protected Member Functions | |
| static void | copy_items (const T *src, size_t count, T *dst) |
Protected Attributes | |
| const T * | data_ {nullptr} |
| size_t | size_ {0} |
Static Protected Attributes | |
| static constexpr size_t | OWNED_BIT = size_t{1} << (sizeof(size_t) * 8 - 1) |
Owning variant: a codegen table that outlives it, or a heap copy of a runtime list it owns.
Ownership is the top bit of the size; it is not copyable, so a copy can never outlive the owner. Elements must be whole words: on ESP8266, iterating or indexing a codegen table reads them straight from flash.
| using esphome::ConstVector< T, true >::value_type = T |
|
constexprdefault |
|
inlineconstexpr |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestaticprotected |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
delete |
|
inline |
|
inline |
Like append_copy(), with extra placed in front of the current list.
|
inlineprotected |
|
inline |
|
protected |
|
staticconstexprprotected |
|
protected |