This template class describes an extensible array. More...
Public Member Functions | |
| SBCContainerVector () | |
| Constructs an empty vector. | |
| SBCContainerVector (unsigned int n) | |
Constructs a vector of reserved size n. | |
| SBCContainerVector (unsigned int n, unsigned int c, const T &t) | |
Constructs a vector of reserved size n and current size c, filled with copies of t. | |
| SBCContainerVector (const SBCContainerVector &vector) | |
Constructs a copy of vector vector. | |
| virtual | ~SBCContainerVector () |
| Destructs the vector. | |
| SBCContainerVector & | operator= (const SBCContainerVector &vector) |
Assigns a copy of vector vector to this. | |
| T & | getElement (unsigned int i) |
Returns a reference to element i. | |
| T const & | getElement (unsigned int i) const |
Returns a reference to element i. | |
| T & | operator[] (unsigned int i) |
Returns a reference to element i. | |
| T const & | operator[] (unsigned int i) const |
Returns a reference to element i. | |
| T & | front () |
| Returns a reference to the last element. | |
| T const & | front () const |
| Returns a reference to the last element. | |
| T & | back () |
| Returns a reference to the last element. | |
| T const & | back () const |
| Returns a reference to the last element. | |
| T * | getPointer (unsigned int i) |
Returns a pointer to element i. | |
| T const * | getPointer (unsigned int i) const |
Returns a pointer to element i. | |
| void | push_back (const T &t) |
Appends t to the vector. | |
| void | insert (unsigned int i, const T &t) |
Inserts t at position i if possible. If an element was present at position i, it is pushed at the back of the vector. | |
| void | insertLinear (unsigned int i, const T &t) |
| void | pop_back () |
| Removes the last element from the vector. | |
| void | remove (unsigned int i) |
Removes element i from the vector, and replaces it with the last element. | |
| void | removeLinear (unsigned int i) |
| void | removeLinear (unsigned int first, unsigned int last) |
| bool | empty () const |
| Returns true if and only if the vector is empty. | |
| void | clear () |
| Empties the vector. | |
| unsigned int | allocatedSize () const |
| Returns the allocated size (in memory) of the vector. | |
| unsigned int | size () const |
| Returns the size of the vector. | |
| iterator | begin () |
| Returns an iterator that points to the beginning of the vector. | |
| const_iterator | begin () const |
| Returns an iterator that points to the beginning of the vector. | |
| iterator | end () |
| Returns an iterator that points to the end of the vector. | |
| const_iterator | end () const |
| Returns an iterator that points to the end of the vector. | |
| reverse_iterator | rbegin () |
| Returns a reverse iterator that points to the reverse beginning of the vector. | |
| const_reverse_iterator | rbegin () const |
| Returns a reverse iterator that points to the reverse beginning of the vector. | |
| reverse_iterator | rend () |
| Returns a reverse iterator that points to the reverse end of the vector. | |
| const_reverse_iterator | rend () const |
| Returns a reverse iterator that points to the reverse end of the vector. | |
| void | print (unsigned int offset=0) const |
| Prints the vector. | |
| unsigned int | getMemoryFootPrint () const |
| Returns the memory footprint of the vector. | |
SBCContainerVector is a lightweight template class to handle vectors of values, i.e. contiguous arrays of values. Its functionality is similar to the std::vector class. SBVector provides const and non-const iterators and reverse iterators:
Note that, in accordance with the behavior of buffers, indexers, etc., the insert function has a amortized constant time complexity, as it pushes back the replaced element to the end of the vector.
Short name: SBVector
|
inline |
Inserts t at position i if possible. If an element was present at position i, this element and all following elements are moved. This operation has a linear complexity, and may invalidate iterators.
|
inline |
Removes element i from the vector. If elements are present after position i, these elements are moved. This operation has a linear complexity, and may invalidate iterators.
|
inline |
Removes all elements between (and including) positions first and last. If elements are present after position last, these elements are moved. This operation has a linear complexity, and may invalidate iterators.