Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ivector< T > Class Template Reference
[vector]
The base class for specifically sized vectors. More...
#include <vector.h>
Inherits etl::vector_base.
Inherited by vector< T, MAX_SIZE_ >.
Public Member Functions | |
iterator | begin () |
Returns an iterator to the beginning of the vector. | |
const_iterator | begin () const |
Returns a const_iterator to the beginning of the vector. | |
iterator | end () |
Returns an iterator to the end of the vector. | |
const_iterator | end () const |
Returns a const_iterator to the end of the vector. | |
const_iterator | cbegin () const |
Returns a const_iterator to the beginning of the vector. | |
const_iterator | cend () const |
Returns a const_iterator to the end of the vector. | |
reverse_iterator | rbegin () |
Returns an reverse iterator to the reverse beginning of the vector. | |
const_reverse_iterator | rbegin () const |
Returns a const reverse iterator to the reverse beginning of the vector. | |
reverse_iterator | rend () |
Returns a reverse iterator to the end + 1 of the vector. | |
const_reverse_iterator | rend () const |
Returns a const reverse iterator to the end + 1 of the vector. | |
const_reverse_iterator | crbegin () const |
Returns a const reverse iterator to the reverse beginning of the vector. | |
const_reverse_iterator | crend () const |
Returns a const reverse iterator to the end + 1 of the vector. | |
void | resize (size_t new_size) |
Resizes the vector. | |
void | resize (size_t new_size, T value) |
Resizes the vector. | |
void | reserve (size_t) |
Does nothing. | |
reference | operator[] (size_t i) |
Returns a reference to the value at index 'i'. | |
const_reference | operator[] (size_t i) const |
Returns a const reference to the value at index 'i'. | |
reference | at (size_t i) |
Returns a reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range. | |
const_reference | at (size_t i) const |
Returns a const reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range. | |
reference | front () |
Returns a reference to the first element. | |
const_reference | front () const |
Returns a const reference to the first element. | |
reference | back () |
Returns a reference to the last element. | |
const_reference | back () const |
Returns a const reference to the last element. | |
pointer | data () |
Returns a pointer to the beginning of the vector data. | |
const_pointer | data () const |
Returns a const pointer to the beginning of the vector data. | |
template<typename TIterator > | |
void | assign (TIterator first, TIterator last) |
Assigns values to the vector. | |
void | assign (size_t n, parameter_t value) |
Assigns values to the vector. | |
void | clear () |
Clears the vector. | |
void | push_back () |
Increases the size of the vector by one, but does not initialise the new element. | |
void | push_back (parameter_t value) |
Inserts a value at the end of the vector. | |
template<typename T1 > | |
void | emplace_back (const T1 &value1) |
Constructs a value at the end of the vector. | |
template<typename T1 , typename T2 > | |
void | emplace_back (const T1 &value1, const T2 &value2) |
Constructs a value at the end of the vector. | |
template<typename T1 , typename T2 , typename T3 > | |
void | emplace_back (const T1 &value1, const T2 &value2, const T3 &value3) |
Constructs a value at the end of the vector. | |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
void | emplace_back (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4) |
Constructs a value at the end of the vector. | |
void | pop_back () |
Removes an element from the end of the vector. | |
iterator | insert (iterator position, parameter_t value) |
Inserts a value to the vector. | |
template<typename T1 > | |
iterator | emplace (iterator position, const T1 &value1) |
Emplaces a value to the vextor at the specified position. | |
template<typename T1 , typename T2 > | |
iterator | emplace (iterator position, const T1 &value1, const T2 &value2) |
Emplaces a value to the vextor at the specified position. | |
template<typename T1 , typename T2 , typename T3 > | |
iterator | emplace (iterator position, const T1 &value1, const T2 &value2, const T3 &value3) |
Emplaces a value to the vextor at the specified position. | |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
iterator | emplace (iterator position, const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4) |
Emplaces a value to the vextor at the specified position. | |
void | insert (iterator position, size_t n, parameter_t value) |
Inserts 'n' values to the vector. | |
template<class TIterator > | |
void | insert (iterator position, TIterator first, TIterator last) |
Inserts a range of values to the vector. | |
iterator | erase (iterator i_element) |
Erases an element. | |
iterator | erase (iterator first, iterator last) |
Erases a range of elements. | |
ivector & | operator= (const ivector &rhs) |
Assignment operator. | |
size_type | size () const |
Gets the current size of the vector. | |
bool | empty () const |
Checks the 'empty' state of the vector. | |
bool | full () const |
Checks the 'full' state of the vector. | |
size_t | available () const |
Returns the remaining capacity. | |
virtual void | repair ()=0 |
Fix the internal pointers after a low level memory copy. | |
size_type | capacity () const |
Returns the capacity of the vector. | |
size_type | max_size () const |
Returns the maximum possible size of the vector. | |
Protected Member Functions | |
ivector (T *p_buffer_, size_t MAX_SIZE) | |
Constructor. | |
void | initialise () |
Initialise the vector. | |
void | repair (T *p_buffer_) |
Fix the internal pointers after a low level memory copy. | |
Protected Attributes | |
const size_type | CAPACITY |
The maximum number of elements in the vector. | |
etl::debug_count | construct_count |
Internal debugging. |
Detailed Description
template<typename T>
class etl::ivector< T >
The base class for specifically sized vectors.
Can be used as a reference type for all vectors containing a specific type.
Definition at line 74 of file vector.h.
Constructor & Destructor Documentation
ivector | ( | T * | p_buffer_, |
size_t | MAX_SIZE | ||
) | [protected] |
Member Function Documentation
void assign | ( | TIterator | first, |
TIterator | last | ||
) |
Assigns values to the vector.
If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. If asserts or exceptions are enabled, emits vector_iterator if the iterators are reversed.
- Parameters:
-
first The iterator to the first element. last The iterator to the last element + 1.
void assign | ( | size_t | n, |
parameter_t | value | ||
) |
Assigns values to the vector.
If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
- Parameters:
-
n The number of elements to add. value The value to insert for each element.
const_reference at | ( | size_t | i ) | const |
Returns a const reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.
- Parameters:
-
i The index.
- Returns:
- A const reference to the value at index 'i'
reference at | ( | size_t | i ) |
Returns a reference to the value at index 'i' If asserts or exceptions are enabled, emits an etl::vector_out_of_bounds if the index is out of range.
- Parameters:
-
i The index.
- Returns:
- A reference to the value at index 'i'
size_t available | ( | ) | const |
reference back | ( | ) |
const_reference back | ( | ) | const |
iterator begin | ( | ) |
const_iterator begin | ( | ) | const |
size_type capacity | ( | ) | const [inherited] |
Returns the capacity of the vector.
- Returns:
- The capacity of the vector.
Definition at line 133 of file vector_base.h.
const_iterator cbegin | ( | ) | const |
const_iterator cend | ( | ) | const |
const_reverse_iterator crbegin | ( | ) | const |
const_reverse_iterator crend | ( | ) | const |
pointer data | ( | ) |
const_pointer data | ( | ) | const |
iterator emplace | ( | iterator | position, |
const T1 & | value1 | ||
) |
iterator emplace | ( | iterator | position, |
const T1 & | value1, | ||
const T2 & | value2 | ||
) |
iterator emplace | ( | iterator | position, |
const T1 & | value1, | ||
const T2 & | value2, | ||
const T3 & | value3 | ||
) |
iterator emplace | ( | iterator | position, |
const T1 & | value1, | ||
const T2 & | value2, | ||
const T3 & | value3, | ||
const T4 & | value4 | ||
) |
void emplace_back | ( | const T1 & | value1, |
const T2 & | value2 | ||
) |
Constructs a value at the end of the vector.
If asserts or exceptions are enabled, emits vector_full if the vector is already full.
- Parameters:
-
value The value to add.
void emplace_back | ( | const T1 & | value1, |
const T2 & | value2, | ||
const T3 & | value3 | ||
) |
Constructs a value at the end of the vector.
If asserts or exceptions are enabled, emits vector_full if the vector is already full.
- Parameters:
-
value The value to add.
void emplace_back | ( | const T1 & | value1, |
const T2 & | value2, | ||
const T3 & | value3, | ||
const T4 & | value4 | ||
) |
Constructs a value at the end of the vector.
If asserts or exceptions are enabled, emits vector_full if the vector is already full.
- Parameters:
-
value The value to add.
void emplace_back | ( | const T1 & | value1 ) |
Constructs a value at the end of the vector.
If asserts or exceptions are enabled, emits vector_full if the vector is already full.
- Parameters:
-
value The value to add.
bool empty | ( | ) | const |
const_iterator end | ( | ) | const |
iterator end | ( | ) |
iterator erase | ( | iterator | i_element ) |
iterator erase | ( | iterator | first, |
iterator | last | ||
) |
Erases a range of elements.
The range includes all the elements between first and last, including the element pointed by first, but not the one pointed by last.
- Parameters:
-
first Iterator to the first element. last Iterator to the last element.
- Returns:
- An iterator pointing to the element that followed the erased element.
reference front | ( | ) |
const_reference front | ( | ) | const |
bool full | ( | ) | const |
iterator insert | ( | iterator | position, |
parameter_t | value | ||
) |
Inserts a value to the vector.
If asserts or exceptions are enabled, emits vector_full if the vector is already full.
- Parameters:
-
position The position to insert before. value The value to insert.
void insert | ( | iterator | position, |
TIterator | first, | ||
TIterator | last | ||
) |
Inserts a range of values to the vector.
If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space. For fundamental and pointer types.
- Parameters:
-
position The position to insert before. first The first element to add. last The last + 1 element to add.
void insert | ( | iterator | position, |
size_t | n, | ||
parameter_t | value | ||
) |
Inserts 'n' values to the vector.
If asserts or exceptions are enabled, emits vector_full if the vector does not have enough free space.
- Parameters:
-
position The position to insert before. n The number of elements to add. value The value to insert.
size_type max_size | ( | ) | const [inherited] |
Returns the maximum possible size of the vector.
- Returns:
- The maximum size of the vector.
Definition at line 142 of file vector_base.h.
reference operator[] | ( | size_t | i ) |
const_reference operator[] | ( | size_t | i ) | const |
void pop_back | ( | ) |
void push_back | ( | ) |
Increases the size of the vector by one, but does not initialise the new element.
If asserts or exceptions are enabled, throws a vector_full if the vector is already full.
void push_back | ( | parameter_t | value ) |
Inserts a value at the end of the vector.
If asserts or exceptions are enabled, emits vector_full if the vector is already full.
- Parameters:
-
value The value to add.
const_reverse_iterator rbegin | ( | ) | const |
reverse_iterator rbegin | ( | ) |
const_reverse_iterator rend | ( | ) | const |
reverse_iterator rend | ( | ) |
virtual void repair | ( | ) | [pure virtual] |
Fix the internal pointers after a low level memory copy.
Implemented in vector< T, MAX_SIZE_ >, vector< etl::task *, MAX_TASKS >, vector< etl::imessage_router *, MAX_ROUTERS_ >, vector< value_type *, MAX_SIZE >, vector< node_t *, MAX_SIZE >, and vector< TObserver *, MAX_OBSERVERS >.
void repair | ( | T * | p_buffer_ ) | [protected] |
void resize | ( | size_t | new_size ) |
Resizes the vector.
If asserts or exceptions are enabled and the new size is larger than the maximum then a vector_full is thrown.
- Parameters:
-
new_size The new size.
void resize | ( | size_t | new_size, |
T | value | ||
) |
Resizes the vector.
If asserts or exceptions are enabled and the new size is larger than the maximum then a vector_full is thrown.
- Parameters:
-
new_size The new size. value The value to fill new elements with. Default = default constructed value.
size_type size | ( | ) | const |
Field Documentation
const size_type CAPACITY [protected, inherited] |
The maximum number of elements in the vector.
Definition at line 157 of file vector_base.h.
etl::debug_count construct_count [protected, inherited] |
Internal debugging.
Definition at line 158 of file vector_base.h.
Generated on Tue Jul 12 2022 14:05:56 by
