Lightweight wrapper around std::vector with Arduino-friendly helpers and a pluggable allocator.
More...
template<class T, class Alloc = DLNA_ALLOCATOR<T>>
class tiny_dlna::Vector< T, Alloc >
Lightweight wrapper around std::vector with Arduino-friendly helpers and a pluggable allocator.
This container inherits from std::vector to preserve its API and complexity guarantees while adding a few conveniences tailored for embedded/Arduino targets:
- Uses a configurable allocator (default: DLNA_ALLOCATOR<T>) defined by the library to enable custom allocation strategies or tracking.
- Keeps all standard std::vector constructors, types, and methods available.
- Exposes std::vector erase overloads and provides index-based helpers.
- Adds reset() which performs clear() followed by shrink_to_fit() to aggressively release memory.
Template parameters:
- Template Parameters
-
| T | Element/value type stored in the vector. |
- Template Parameters
-
| Alloc | Allocator type (defaults to DLNA_ALLOCATOR<T> as configured in dlna_config.h). |
Differences vs std::vector:
- erase(size_t index): convenience overload that erases an element by index and returns the iterator following the erased element (or end() if the last element was erased). If the index is out of range, end() is returned and no action is taken.
- eraseIndex(int index): bounds-checked helper; does nothing on out-of-range indices.
Complexity: Matches std::vector for the corresponding operations (e.g. erase is linear in the number of moved elements). Reserve/capacity/iterator invalidation rules are also identical to std::vector.