ESP32 PSRAM Library
Public Types | Public Member Functions | List of all members
esp32_psram::VectorHIMEM< T > Class Template Reference

Vector implementation that uses ESP32's high memory (himem) for storage. More...

#include <VectorHIMEM.h>

Public Types

using const_pointer = const T *
 
using const_reference = const T &
 
using difference_type = std::ptrdiff_t
 
using pointer = T *
 
using reference = T &
 
using size_type = size_t
 
using value_type = T
 

Public Member Functions

 VectorHIMEM ()=default
 Default constructor - creates an empty vector.
 
 VectorHIMEM (const VectorHIMEM &other)
 Copy constructor. More...
 
 VectorHIMEM (size_type count)
 Constructs a vector with the given number of default-initialized elements. More...
 
 VectorHIMEM (size_type count, const T &value)
 Constructs a vector with the given number of copies of a value. More...
 
 VectorHIMEM (std::initializer_list< T > init)
 Initializer list constructor. More...
 
 VectorHIMEM (VectorHIMEM &&other) noexcept
 Move constructor. More...
 
 ~VectorHIMEM ()
 Destructor - ensures all elements are properly destroyed.
 
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...
 
size_type capacity () const
 Get the number of elements that can be held in current storage. More...
 
void clear ()
 Clear the contents.
 
bool empty () const
 Check if the vector is empty. More...
 
void erase (size_type pos)
 Erase an element. More...
 
reference front ()
 Access the first element. More...
 
const_reference front () const
 Access the first element (const version) More...
 
void insert (size_type pos, const T &value)
 Insert an element at a specific position. More...
 
size_type max_size () const
 Get the maximum possible number of elements. More...
 
VectorHIMEMoperator= (const VectorHIMEM &other)
 Copy assignment operator. More...
 
VectorHIMEMoperator= (std::initializer_list< T > ilist)
 Initializer list assignment operator. More...
 
VectorHIMEMoperator= (VectorHIMEM &&other) noexcept
 Move assignment operator. More...
 
reference operator[] (size_type pos)
 Access element without bounds checking. More...
 
const_reference operator[] (size_type pos) const
 
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...
 
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...
 
size_type size () const
 Get the number of elements. More...
 
void swap (VectorHIMEM &other) noexcept
 Swap the contents of this vector with another. More...
 

Detailed Description

template<typename T>
class esp32_psram::VectorHIMEM< T >

Vector implementation that uses ESP32's high memory (himem) for storage.

Template Parameters
TType of elements stored in the vector

Constructor & Destructor Documentation

◆ VectorHIMEM() [1/5]

template<typename T >
esp32_psram::VectorHIMEM< T >::VectorHIMEM ( size_type  count)
inlineexplicit

Constructs a vector with the given number of default-initialized elements.

Parameters
countThe size of the vector

◆ VectorHIMEM() [2/5]

template<typename T >
esp32_psram::VectorHIMEM< T >::VectorHIMEM ( size_type  count,
const T &  value 
)
inline

Constructs a vector with the given number of copies of a value.

Parameters
countThe size of the vector
valueThe value to initialize elements with

◆ VectorHIMEM() [3/5]

template<typename T >
esp32_psram::VectorHIMEM< T >::VectorHIMEM ( const VectorHIMEM< T > &  other)
inline

Copy constructor.

Parameters
otherThe vector to copy from

◆ VectorHIMEM() [4/5]

template<typename T >
esp32_psram::VectorHIMEM< T >::VectorHIMEM ( VectorHIMEM< T > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherThe vector to move from

◆ VectorHIMEM() [5/5]

template<typename T >
esp32_psram::VectorHIMEM< T >::VectorHIMEM ( std::initializer_list< T >  init)
inline

Initializer list constructor.

Parameters
initThe initializer list to copy from

Member Function Documentation

◆ at() [1/2]

template<typename T >
reference esp32_psram::VectorHIMEM< T >::at ( size_type  pos)
inline

Access element with bounds checking.

Parameters
posThe position of the element
Returns
Reference to the element at position pos
Exceptions
std::out_of_rangeif pos is not within the range of the vector

◆ at() [2/2]

template<typename T >
const_reference esp32_psram::VectorHIMEM< T >::at ( size_type  pos) const
inline

Access element with bounds checking (const version)

Parameters
posThe position of the element
Returns
Const reference to the element at position pos
Exceptions
std::out_of_rangeif pos is not within the range of the vector

◆ back() [1/2]

template<typename T >
reference esp32_psram::VectorHIMEM< T >::back ( )
inline

Access the last element.

Returns
Reference to the last element

◆ back() [2/2]

template<typename T >
const_reference esp32_psram::VectorHIMEM< T >::back ( ) const
inline

Access the last element (const version)

Returns
Const reference to the last element

◆ capacity()

template<typename T >
size_type esp32_psram::VectorHIMEM< T >::capacity ( ) const
inline

Get the number of elements that can be held in current storage.

Returns
The capacity of the vector

◆ empty()

template<typename T >
bool esp32_psram::VectorHIMEM< T >::empty ( ) const
inline

Check if the vector is empty.

Returns
true if the vector is empty, false otherwise

◆ erase()

template<typename T >
void esp32_psram::VectorHIMEM< T >::erase ( size_type  pos)
inline

Erase an element.

Parameters
posIndex of the element to erase

◆ front() [1/2]

template<typename T >
reference esp32_psram::VectorHIMEM< T >::front ( )
inline

Access the first element.

Returns
Reference to the first element

◆ front() [2/2]

template<typename T >
const_reference esp32_psram::VectorHIMEM< T >::front ( ) const
inline

Access the first element (const version)

Returns
Const reference to the first element

◆ insert()

template<typename T >
void esp32_psram::VectorHIMEM< T >::insert ( size_type  pos,
const T &  value 
)
inline

Insert an element at a specific position.

Parameters
posPosition where the element should be inserted
valueThe value to insert

◆ max_size()

template<typename T >
size_type esp32_psram::VectorHIMEM< T >::max_size ( ) const
inline

Get the maximum possible number of elements.

Returns
The maximum possible number of elements the vector can hold

◆ operator=() [1/3]

template<typename T >
VectorHIMEM& esp32_psram::VectorHIMEM< T >::operator= ( const VectorHIMEM< T > &  other)
inline

Copy assignment operator.

Parameters
otherThe vector to copy from
Returns
Reference to this vector

◆ operator=() [2/3]

template<typename T >
VectorHIMEM& esp32_psram::VectorHIMEM< T >::operator= ( std::initializer_list< T >  ilist)
inline

Initializer list assignment operator.

Parameters
ilistThe initializer list to copy from
Returns
Reference to this vector

◆ operator=() [3/3]

template<typename T >
VectorHIMEM& esp32_psram::VectorHIMEM< T >::operator= ( VectorHIMEM< T > &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe vector to move from
Returns
Reference to this vector

◆ operator[]()

template<typename T >
reference esp32_psram::VectorHIMEM< T >::operator[] ( size_type  pos)
inline

Access element without bounds checking.

Parameters
posThe position of the element
Returns
Reference to the element at position pos

◆ push_back() [1/2]

template<typename T >
void esp32_psram::VectorHIMEM< T >::push_back ( const T &  value)
inline

Add an element to the end.

Parameters
valueThe value to append

◆ push_back() [2/2]

template<typename T >
void esp32_psram::VectorHIMEM< T >::push_back ( T &&  value)
inline

Add an element to the end by moving it.

Parameters
valueThe value to append

◆ reserve()

template<typename T >
void esp32_psram::VectorHIMEM< T >::reserve ( size_type  new_cap)
inline

Reserve storage.

Parameters
new_capThe new capacity of the vector

◆ resize() [1/2]

template<typename T >
void esp32_psram::VectorHIMEM< T >::resize ( size_type  count)
inline

Change the number of elements stored.

Parameters
countThe new size of the vector

◆ resize() [2/2]

template<typename T >
void esp32_psram::VectorHIMEM< T >::resize ( size_type  count,
const value_type &  value 
)
inline

Change the number of elements stored.

Parameters
countThe new size of the vector
valueThe value to initialize new elements with

◆ size()

template<typename T >
size_type esp32_psram::VectorHIMEM< T >::size ( ) const
inline

Get the number of elements.

Returns
The number of elements in the vector

◆ swap()

template<typename T >
void esp32_psram::VectorHIMEM< T >::swap ( VectorHIMEM< T > &  other)
inlinenoexcept

Swap the contents of this vector with another.

Parameters
otherVector to swap with

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