vector class influenced by standard library
More...
#include <object/vector.h>
template<class T>
class vector< T >
vector class influenced by standard library
Constructor.
- Parameters
-
invalid | object for invalid returns |
template<class T >
vector< T >::vector |
( |
size_t |
count, |
|
|
T |
init, |
|
|
T |
invalid = T() |
|
) |
| |
|
inlineexplicit |
Constructor with initial _capacity.
- Parameters
-
count | number of initial values |
init | initial values |
invalid | object for invalid returns |
template<class T >
T& vector< T >::at |
( |
size_t |
pos | ) |
|
|
inline |
access specified element
- Parameters
-
pos | position of the element to return |
- Returns
- element or T() if out of bounds
- Note
- This function differs to the standard library due to the lack of exceptions
Access the first element.
- Returns
- first element or T() if none
Access the last element.
- Returns
- last element or T() if none
direct access to the underlying array
- Returns
- Pointer to data
template<class T >
size_t vector< T >::size |
( |
| ) |
const |
|
inline |
Get the number of elements.
- Returns
- number of entires
template<class T >
size_t vector< T >::capacity |
( |
| ) |
const |
|
inline |
Get the number of elements that can be held in currently allocated storage.
- Returns
- current capacity
template<class T >
void vector< T >::reserve |
( |
size_t |
capacity | ) |
|
|
inline |
Increase the capacity of the vector.
- Parameters
-
template<class T >
void vector< T >::resize |
( |
size_t |
count, |
|
|
T |
value |
|
) |
| |
|
inline |
Resizes the container.
- Parameters
-
count | new size of the container |
value | the value to initialize the new elements with |
template<class T >
void vector< T >::resize |
( |
size_t |
count | ) |
|
|
inline |
Resizes the container.
- Parameters
-
count | new size of the container |
template<class T >
void vector< T >::push_back |
( |
const T & |
value | ) |
|
|
inline |
Adds an element to the end.
- Parameters
-
value | the value of the element to append |
template<class T >
void vector< T >::insert |
( |
size_t |
pos, |
|
|
const T & |
value |
|
) |
| |
|
inline |
Inserts elements at the specified location.
- Parameters
-
Remove the last element.
- Returns
- last element
template<class T >
T vector< T >::remove |
( |
size_t |
pos | ) |
|
|
inline |
Remove element at the specified location.
- Parameters
-
- Returns
- value or T() if position out of bounds
template<class T >
T& vector< T >::operator[] |
( |
int |
i | ) |
|
|
inline |
Access Element.
- Parameters
-
Concatenate vector.
- Parameters
-
- Returns
- reference to vector
Concatenate element.
- Parameters
-
- Returns
- reference to vector
Concatenate two vectors.
- Parameters
-
- Returns
- new vector with all elements of this and other vector
Concatenate element.
- Parameters
-
element | element to Concatenate |
- Returns
- new vector with all elements of this vector and element
Iterator to beginning.
- Returns
- Iterator pointing to the first element in the sequence
Iterator to end.
- Returns
- Iterator pointing to the past-the-end element in the sequence
The documentation for this class was generated from the following file: