TinyRobotics
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
VectorFromArray< T, N > Class Template Reference

A simple, fixed-capacity vector backed by std::array for embedded and performance-critical use. More...

#include <VectorFromArray.h>

Public Member Functions

bool push_back (const T &value)
 
void clear ()
 
std::size_t size () const
 
constexpr std::size_t capacity () const
 
T & operator[] (std::size_t idx)
 
const T & operator[] (std::size_t idx) const
 
T * begin ()
 
T * end ()
 
const T * begin () const
 
const T * end () const
 

Protected Attributes

std::array< T, N > data
 
std::size_t sz
 

Detailed Description

template<typename T, std::size_t N>
class tinyrobotics::VectorFromArray< T, N >

A simple, fixed-capacity vector backed by std::array for embedded and performance-critical use.

VectorFromArray provides a subset of the std::vector API, but with no dynamic memory allocation. All storage is allocated at compile time, making it suitable for microcontrollers, real-time systems, or any environment where heap usage is undesirable or unavailable.

Features:

Limitations:

Example usage:

v.push_back(1);
v.push_back(2);
for (auto x : v) {
Serial.println(x);
}
v.clear();
A simple, fixed-capacity vector backed by std::array for embedded and performance-critical use.
Definition: VectorFromArray.h:47
Template Parameters
TElement type
NMaximum number of elements (capacity)

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