38template <
class T,
class Alloc = DLNA_ALLOCATOR<T>>
39class Vector :
public std::vector<T, Alloc> {
41 using Base = std::vector<T, Alloc>;
51 Vector(
size_t count,
const T &value) :
Base(count, value) {}
63 if (index < 0 ||
static_cast<size_t>(index) >= this->size())
return;
64 Base::erase(this->begin() + index);
74 if (index >= this->size())
return this->end();
75 return Base::erase(this->begin() +
static_cast<typename Base::difference_type
>(index));
85 this->shrink_to_fit();
Lightweight wrapper around std::vector with Arduino-friendly helpers and a pluggable allocator.
Definition: Vector.h:39
std::vector< T, Alloc > Base
Definition: Vector.h:41
T value_type
Definition: Vector.h:43
void reset()
Reset the container by clearing and shrinking capacity to fit.
Definition: Vector.h:83
void eraseIndex(int index)
Erase element by index (no-op on out-of-range).
Definition: Vector.h:62
typename Base::iterator iterator
Definition: Vector.h:44
Vector(It first, It last)
Definition: Vector.h:53
Vector(size_t count)
Definition: Vector.h:50
Vector(std::initializer_list< T > il)
Definition: Vector.h:54
typename Base::const_iterator const_iterator
Definition: Vector.h:45
Vector(const Alloc &alloc)
Definition: Vector.h:55
iterator erase(size_t index)
Convenience overload to erase by index.
Definition: Vector.h:73
Vector(size_t count, const T &value)
Definition: Vector.h:51
Definition: Allocator.h:13