vector is a base class implementing an array of elements It cannot be instantiated on it's own since it's missing the mechanism for allocating the memory required by the vector
More...
#include <ds_types_vector.h>
|
| vector () |
| Creates an empty vector.
|
|
| vector (const vector &rhs)=delete |
|
void | clear (void) |
| Clears all the elements of the vector.
|
|
size_t | capacity (void) const |
| Returns the capacity of the vector.
|
|
size_t | size (void) const |
| Returns the number of elements in the vector.
|
|
const T * | data (void) const |
| Returns the pointer to the C array underlying the vector.
|
|
T * | data (void) |
| Returns the pointer to the C array underlying the vector.
|
|
T & | operator[] (size_t pos) |
| Access operator [].
|
|
int32_t | find (const T &value) |
| Searches for the first element matching the specified value.
|
|
int32_t | find (const lambda< bool(const T &item)> &equals) |
| Searches for the first element matching the specified value. Uses a lambda to perform the matching.
|
|
void | append (const T &item) |
| Appends an element at the end of the vector.
|
|
void | append (const T &item, size_t count) |
| Appends an element one or more times at the end of the vector.
|
|
void | append (const vector< T > &items) |
| Appends the elements from the supplied vector at the end of the current vector.
|
|
void | append (const vector< T > &items, size_t count) |
| Appends a number of elements from the supplied vector at the end of the current vector.
|
|
void | insert (const T &item, size_t pos) |
| Inserts an element at a specified position in the vector.
|
|
void | insert (const T &item, size_t count, size_t pos) |
| Inserts an element one or more times at a specified position in the vector.
|
|
void | insert (const vector< T > &items, size_t pos) |
| Inserts the elements from the supplied vector at a specified position in the vector.
|
|
void | insert (const vector< T > &items, size_t count, size_t pos) |
| Inserts a number of elements from the supplied vector at a specified position in the vector.
|
|
void | insert (const T *items, size_t count, size_t pos) |
| Inserts the elements from the supplied C array at a specified position in the vector.
|
|
void | erase (size_t pos, size_t count) |
| Erases elements from the vector.
|
|
|
virtual T * | getMemory (void)=0 |
|
virtual size_t | getCapacity (void) const =0 |
|
|
T * | mArray |
|
size_t | mCapacity |
|
template<typename T>
class vector< T >
vector is a base class implementing an array of elements It cannot be instantiated on it's own since it's missing the mechanism for allocating the memory required by the vector
◆ append() [1/4]
template<typename T >
void vector< T >::append |
( |
const T & |
item | ) |
|
|
inline |
Appends an element at the end of the vector.
- Parameters
-
◆ append() [2/4]
template<typename T >
void vector< T >::append |
( |
const T & |
item, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Appends an element one or more times at the end of the vector.
- Parameters
-
item | Item to append |
count | Number of times to append the element |
◆ append() [3/4]
Appends the elements from the supplied vector at the end of the current vector.
- Parameters
-
items | Vector containing the elements to append |
◆ append() [4/4]
template<typename T >
void vector< T >::append |
( |
const vector< T > & |
items, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Appends a number of elements from the supplied vector at the end of the current vector.
- Parameters
-
items | Vector containing the source elements |
count | Maximum number of source elements to append |
◆ capacity()
template<typename T >
size_t vector< T >::capacity |
( |
void |
| ) |
const |
|
inline |
Returns the capacity of the vector.
- Returns
- Number of elements the vector can store
◆ data() [1/2]
template<typename T >
T * vector< T >::data |
( |
void |
| ) |
|
|
inline |
Returns the pointer to the C array underlying the vector.
- Returns
- Pointer to the C array of the vector
◆ data() [2/2]
template<typename T >
const T * vector< T >::data |
( |
void |
| ) |
const |
|
inline |
Returns the pointer to the C array underlying the vector.
- Returns
- Pointer to the C array of the vector
◆ erase()
template<typename T >
void vector< T >::erase |
( |
size_t |
pos, |
|
|
size_t |
count |
|
) |
| |
|
inline |
Erases elements from the vector.
- Parameters
-
pos | Position to remove elements from |
count | Number of elements to remove from the specified position |
◆ find() [1/2]
template<typename T >
int32_t vector< T >::find |
( |
const lambda< bool(const T &item)> & |
equals | ) |
|
|
inline |
Searches for the first element matching the specified value. Uses a lambda to perform the matching.
- Parameters
-
equals | Lambda that returns true if the element "item" is the one looking for |
- Returns
- Index of the element if found or -1 if the element was not found
◆ find() [2/2]
template<typename T >
int32_t vector< T >::find |
( |
const T & |
value | ) |
|
|
inline |
Searches for the first element matching the specified value.
- Parameters
-
value | Element to search for |
- Returns
- Index of the element if found or -1 if the element was not found
◆ insert() [1/5]
template<typename T >
void vector< T >::insert |
( |
const T & |
item, |
|
|
size_t |
count, |
|
|
size_t |
pos |
|
) |
| |
|
inline |
Inserts an element one or more times at a specified position in the vector.
- Parameters
-
item | Item to append |
count | Number of times to insert the element |
pos | Position to insert at |
◆ insert() [2/5]
template<typename T >
void vector< T >::insert |
( |
const T & |
item, |
|
|
size_t |
pos |
|
) |
| |
|
inline |
Inserts an element at a specified position in the vector.
- Parameters
-
item | Item to append |
pos | Position to insert at |
◆ insert() [3/5]
template<typename T >
void vector< T >::insert |
( |
const T * |
items, |
|
|
size_t |
count, |
|
|
size_t |
pos |
|
) |
| |
|
inline |
Inserts the elements from the supplied C array at a specified position in the vector.
- Parameters
-
items | C array containing the source elements |
count | Number of source elements to insert |
pos | Position to insert at |
◆ insert() [4/5]
template<typename T >
void vector< T >::insert |
( |
const vector< T > & |
items, |
|
|
size_t |
count, |
|
|
size_t |
pos |
|
) |
| |
|
inline |
Inserts a number of elements from the supplied vector at a specified position in the vector.
- Parameters
-
items | Vector containing the source elements |
count | Maximum number of source elements to insert |
pos | Position to insert at |
◆ insert() [5/5]
template<typename T >
void vector< T >::insert |
( |
const vector< T > & |
items, |
|
|
size_t |
pos |
|
) |
| |
|
inline |
Inserts the elements from the supplied vector at a specified position in the vector.
- Parameters
-
items | Vector containing the source elements |
pos | Position to insert at |
◆ operator[]()
template<typename T >
T & vector< T >::operator[] |
( |
size_t |
pos | ) |
|
|
inline |
Access operator [].
- Parameters
-
pos | Index of the element to access |
- Returns
- Reference T& to the element at position "pos"
◆ size()
template<typename T >
size_t vector< T >::size |
( |
void |
| ) |
const |
|
inline |
Returns the number of elements in the vector.
- Returns
- Number of elements in the vector
The documentation for this class was generated from the following file: