Dokumentation
vector class influenced by standard library More...
#include <object/vector.h>
Classes | |
| class | iterator |
| vector iterator More... | |
Public Member Functions | |
| vector (T invalid=T()) | |
| Constructor. | |
| vector (size_t count, T init, T invalid=T()) | |
| Constructor with initial _capacity. | |
| vector (const vector &other) | |
| Copy constructor. | |
| ~vector () | |
| Destructor. | |
| T & | at (size_t pos) |
| access specified element | |
| T & | front () |
| Access the first element. | |
| T & | back () |
| Access the last element. | |
| T * | data () |
| direct access to the underlying array | |
| bool | empty () const |
| Checks if the container has no element. | |
| size_t | size () const |
| Get the number of elements. | |
| size_t | capacity () const |
| Get the number of elements that can be held in currently allocated storage. | |
| void | clear () |
| Erases all elements from the container. | |
| void | reserve (size_t capacity) |
| Increase the capacity of the vector. | |
| void | resize (size_t count, T value) |
| Resizes the container. | |
| void | resize (size_t count) |
| Resizes the container. | |
| void | push_back (const T &value) |
| Adds an element to the end. | |
| void | insert (size_t pos, const T &value) |
| Inserts elements at the specified location. | |
| T | pop_back () |
| Remove the last element. | |
| T | remove (size_t pos) |
| Remove element at the specified location. | |
| T & | operator[] (int i) |
| Access Element. | |
| vector< T > & | operator= (const vector< T > &other) |
| Assignment. | |
| vector< T > & | operator+= (const vector< T > &other) |
| Concatenate vector. | |
| vector< T > & | operator+= (const T &element) |
| Concatenate element. | |
| vector< T > | operator+ (const vector< T > &other) const |
| Concatenate two vectors. | |
| vector< T > | operator+ (const T &element) const |
| Concatenate element. | |
| vector< T >::iterator | begin () const |
| Iterator to beginning. | |
| vector< T >::iterator | end () const |
| Iterator to end. | |
Detailed Description
class vector< T >
vector class influenced by standard library
Constructor & Destructor Documentation
Constructor.
- Parameters
-
invalid object for invalid returns
Constructor with initial _capacity.
- Parameters
-
count number of initial values init initial values invalid object for invalid returns
Member Function Documentation
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
|
inline |
Access the first element.
- Returns
- first element or T() if none
|
inline |
Access the last element.
- Returns
- last element or T() if none
|
inline |
direct access to the underlying array
- Returns
- Pointer to data
|
inline |
Checks if the container has no element.
Get the number of elements.
- Returns
- number of entires
Get the number of elements that can be held in currently allocated storage.
- Returns
- current capacity
|
inline |
Erases all elements from the container.
Increase the capacity of the vector.
- Parameters
-
capacity new capacity
Resizes the container.
- Parameters
-
count new size of the container value the value to initialize the new elements with
Resizes the container.
- Parameters
-
count new size of the container
|
inline |
Adds an element to the end.
- Parameters
-
value the value of the element to append
Inserts elements at the specified location.
- Parameters
-
pos position value value
|
inline |
Remove the last element.
- Returns
- last element
Remove element at the specified location.
- Parameters
-
pos position
- Returns
- value or T() if position out of bounds
|
inline |
Access Element.
- Parameters
-
i index
Assignment.
- Parameters
-
other
Concatenate vector.
- Parameters
-
other vector
- Returns
- reference to vector
Concatenate element.
- Parameters
-
element element
- Returns
- reference to vector
Concatenate two vectors.
- Parameters
-
other vector
- 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:
- object/vector.h