ESP32 PSRAM Library
|
Vector implementation that uses ESP32's PSRAM for storage. More...
#include <VectorPSRAM.h>
Public Member Functions | |
VectorPSRAM () | |
Default constructor - creates an empty vector. | |
VectorPSRAM (const VectorPSRAM &other) | |
Copy constructor. More... | |
template<typename InputIt > | |
VectorPSRAM (InputIt first, InputIt last) | |
Constructs a vector with the contents of the range [first, last) More... | |
VectorPSRAM (size_type count) | |
Constructs a vector with the given number of default-initialized elements. More... | |
VectorPSRAM (size_type count, const T &value) | |
Constructs a vector with the given number of copies of a value. More... | |
VectorPSRAM (std::initializer_list< T > init) | |
Initializer list constructor. More... | |
VectorPSRAM (VectorPSRAM &&other) noexcept | |
Move constructor. More... | |
reference | at (size_type pos) |
Access element with bounds checking. More... | |
const_reference | at (size_type pos) const |
Access element with bounds checking (const version) More... | |
reference | back () |
Access the last element. More... | |
const_reference | back () const |
Access the last element (const version) More... | |
const_iterator | begin () const noexcept |
Get const iterator to the beginning. More... | |
iterator | begin () noexcept |
Get iterator to the beginning. More... | |
size_type | capacity () const noexcept |
Get the number of elements that can be held in current storage. More... | |
const_iterator | cbegin () const noexcept |
Get const iterator to the beginning. More... | |
const_iterator | cend () const noexcept |
Get const iterator to the end. More... | |
void | clear () noexcept |
Clear the contents. | |
const_reverse_iterator | crbegin () const noexcept |
Get const reverse iterator to the beginning. More... | |
const_reverse_iterator | crend () const noexcept |
Get const reverse iterator to the end. More... | |
const T * | data () const noexcept |
Get pointer to the underlying array (const version) More... | |
T * | data () noexcept |
Get pointer to the underlying array. More... | |
template<typename... Args> | |
iterator | emplace (const_iterator pos, Args &&... args) |
Construct an element in-place. More... | |
template<typename... Args> | |
reference | emplace_back (Args &&... args) |
Construct an element in-place at the end. More... | |
bool | empty () const noexcept |
Check if the vector is empty. More... | |
const_iterator | end () const noexcept |
Get const iterator to the end. More... | |
iterator | end () noexcept |
Get iterator to the end. More... | |
iterator | erase (const_iterator first, const_iterator last) |
Erase a range of elements. More... | |
iterator | erase (const_iterator pos) |
Erase an element. More... | |
reference | front () |
Access the first element. More... | |
const_reference | front () const |
Access the first element (const version) More... | |
iterator | insert (const_iterator pos, const T &value) |
Insert an element. More... | |
template<typename InputIt > | |
iterator | insert (const_iterator pos, InputIt first, InputIt last) |
Insert elements from a range. More... | |
iterator | insert (const_iterator pos, size_type count, const T &value) |
Insert multiple copies of an element. More... | |
iterator | insert (const_iterator pos, std::initializer_list< T > ilist) |
Insert elements from an initializer list. More... | |
iterator | insert (const_iterator pos, T &&value) |
Insert an element by moving it. More... | |
size_type | max_size () const noexcept |
Get the maximum possible number of elements. More... | |
VectorPSRAM & | operator= (const VectorPSRAM &other) |
Copy assignment operator. More... | |
VectorPSRAM & | operator= (std::initializer_list< T > ilist) |
Initializer list assignment operator. More... | |
VectorPSRAM & | operator= (VectorPSRAM &&other) noexcept |
Move assignment operator. More... | |
reference | operator[] (size_type pos) |
Access element without bounds checking. More... | |
const_reference | operator[] (size_type pos) const |
Access element without bounds checking (const version) More... | |
void | pop_back () |
Remove the last element. | |
void | push_back (const T &value) |
Add an element to the end. More... | |
void | push_back (T &&value) |
Add an element to the end by moving it. More... | |
const_reverse_iterator | rbegin () const noexcept |
Get const reverse iterator to the beginning. More... | |
reverse_iterator | rbegin () noexcept |
Get reverse iterator to the beginning. More... | |
const_reverse_iterator | rend () const noexcept |
Get const reverse iterator to the end. More... | |
reverse_iterator | rend () noexcept |
Get reverse iterator to the end. More... | |
void | reserve (size_type new_cap) |
Reserve storage. More... | |
void | resize (size_type count) |
Change the number of elements stored. More... | |
void | resize (size_type count, const value_type &value) |
Change the number of elements stored. More... | |
void | shrink_to_fit () |
Reduce memory usage by freeing unused memory. | |
size_type | size () const noexcept |
Get the number of elements. More... | |
void | swap (VectorPSRAM &other) noexcept |
Swap the contents. More... | |
Vector implementation that uses ESP32's PSRAM for storage.
T | Type of elements stored in the vector |
This class provides an interface identical to std::vector but allocates all memory in ESP32's PSRAM, which helps preserve the limited internal RAM. It wraps std::vector with a custom allocator that uses PSRAM.
|
inlineexplicit |
Constructs a vector with the given number of default-initialized elements.
count | The size of the vector |
|
inline |
Constructs a vector with the given number of copies of a value.
count | The size of the vector |
value | The value to initialize elements with |
|
inline |
Constructs a vector with the contents of the range [first, last)
InputIt | Input iterator type |
first | Iterator to the first element in the range |
last | Iterator to one past the last element in the range |
|
inline |
Copy constructor.
other | The vector to copy from |
|
inlinenoexcept |
Move constructor.
other | The vector to move from |
|
inline |
Initializer list constructor.
init | The initializer list to copy from |
|
inline |
Access element with bounds checking.
pos | The position of the element |
std::out_of_range | if pos is not within the range of the vector |
|
inline |
Access element with bounds checking (const version)
pos | The position of the element |
std::out_of_range | if pos is not within the range of the vector |
|
inline |
Access the last element.
|
inline |
Access the last element (const version)
|
inlinenoexcept |
Get const iterator to the beginning.
|
inlinenoexcept |
Get iterator to the beginning.
|
inlinenoexcept |
Get the number of elements that can be held in current storage.
|
inlinenoexcept |
Get const iterator to the beginning.
|
inlinenoexcept |
Get const iterator to the end.
|
inlinenoexcept |
Get const reverse iterator to the beginning.
|
inlinenoexcept |
Get const reverse iterator to the end.
|
inlinenoexcept |
Get pointer to the underlying array (const version)
|
inlinenoexcept |
Get pointer to the underlying array.
|
inline |
Construct an element in-place.
Args | Types of arguments to forward to the constructor |
pos | Iterator to the position before which the element will be constructed |
args | Arguments to forward to the constructor |
|
inline |
Construct an element in-place at the end.
Args | Types of arguments to forward to the constructor |
args | Arguments to forward to the constructor |
|
inlinenoexcept |
Check if the vector is empty.
|
inlinenoexcept |
Get const iterator to the end.
|
inlinenoexcept |
Get iterator to the end.
|
inline |
Erase a range of elements.
first | Iterator to the first element to erase |
last | Iterator to one past the last element to erase |
|
inline |
Erase an element.
pos | Iterator to the element to erase |
|
inline |
Access the first element.
|
inline |
Access the first element (const version)
|
inline |
Insert an element.
pos | Iterator to the position before which the element will be inserted |
value | The value to insert |
|
inline |
Insert elements from a range.
InputIt | Input iterator type |
pos | Iterator to the position before which the elements will be inserted |
first | Iterator to the first element in the range |
last | Iterator to one past the last element in the range |
|
inline |
Insert multiple copies of an element.
pos | Iterator to the position before which the elements will be inserted |
count | Number of copies to insert |
value | The value to insert |
|
inline |
Insert elements from an initializer list.
pos | Iterator to the position before which the elements will be inserted |
ilist | The initializer list to insert from |
|
inline |
Insert an element by moving it.
pos | Iterator to the position before which the element will be inserted |
value | The value to insert |
|
inlinenoexcept |
Get the maximum possible number of elements.
|
inline |
Copy assignment operator.
other | The vector to copy from |
|
inline |
Initializer list assignment operator.
ilist | The initializer list to copy from |
|
inlinenoexcept |
Move assignment operator.
other | The vector to move from |
|
inline |
Access element without bounds checking.
pos | The position of the element |
|
inline |
Access element without bounds checking (const version)
pos | The position of the element |
|
inline |
Add an element to the end.
value | The value to append |
|
inline |
Add an element to the end by moving it.
value | The value to append |
|
inlinenoexcept |
Get const reverse iterator to the beginning.
|
inlinenoexcept |
Get reverse iterator to the beginning.
|
inlinenoexcept |
Get const reverse iterator to the end.
|
inlinenoexcept |
Get reverse iterator to the end.
|
inline |
Reserve storage.
new_cap | The new capacity of the vector |
std::length_error | if new_cap > max_size() |
|
inline |
Change the number of elements stored.
count | The new size of the vector |
|
inline |
Change the number of elements stored.
count | The new size of the vector |
value | The value to initialize new elements with |
|
inlinenoexcept |
Get the number of elements.
|
inlinenoexcept |
Swap the contents.
other | Vector to swap with |