ESPHome 2025.12.1
Loading...
Searching...
No Matches
esphome::ConstVector< T > Class Template Reference

Lightweight read-only view over a const array stored in RODATA (will typically be in flash memory) Avoids copying data from flash to RAM by keeping a pointer to the flash data. More...

#include <helpers.h>

Public Member Functions

constexpr ConstVector (const T *data, size_t size)
 
const constexpr T & operator[] (size_t i) const
 
constexpr size_t size () const
 
constexpr bool empty () const
 

Protected Attributes

const T * data_
 
size_t size_
 

Detailed Description

template<typename T>
class esphome::ConstVector< T >

Lightweight read-only view over a const array stored in RODATA (will typically be in flash memory) Avoids copying data from flash to RAM by keeping a pointer to the flash data.

Similar to std::span but with minimal overhead for embedded systems.

Definition at line 118 of file helpers.h.

Constructor & Destructor Documentation

◆ ConstVector()

template<typename T >
esphome::ConstVector< T >::ConstVector ( const T * data,
size_t size )
inlineconstexpr

Definition at line 120 of file helpers.h.

Member Function Documentation

◆ empty()

template<typename T >
bool esphome::ConstVector< T >::empty ( ) const
inlineconstexpr

Definition at line 124 of file helpers.h.

◆ operator[]()

template<typename T >
const constexpr T & esphome::ConstVector< T >::operator[] ( size_t i) const
inlineconstexpr

Definition at line 122 of file helpers.h.

◆ size()

template<typename T >
size_t esphome::ConstVector< T >::size ( ) const
inlineconstexpr

Definition at line 123 of file helpers.h.

Field Documentation

◆ data_

template<typename T >
const T* esphome::ConstVector< T >::data_
protected

Definition at line 127 of file helpers.h.

◆ size_

template<typename T >
size_t esphome::ConstVector< T >::size_
protected

Definition at line 128 of file helpers.h.


The documentation for this class was generated from the following file: