![]() |
SLProject 4.0.000
|
Template class for dynamic vector. More...
#include <SLVector.h>
Public Member Functions | |
| SLVector () | |
| creates empty array More... | |
| SLVector (SLuint size) | |
| creates array w. size More... | |
| SLVector (const SLVector &a) | |
| creates a copy of array a More... | |
| virtual | ~SLVector () |
| standard destructor More... | |
| SLVector< T, U > & | operator= (const SLVector &a) |
| assignment operator More... | |
| SLVector< T, U > & | operator= (const SLVector *a) |
| assignment operator More... | |
| T & | operator[] (SLuint i) |
| access operator More... | |
| void | set (const SLVector &a) |
| set array with another More... | |
| U | size () |
| returns size More... | |
| U | capacity () |
| returns internal size More... | |
| void | push_back (const T element) |
| appends element at end More... | |
| void | pop_back () |
| deletes element at end More... | |
| void | erase (U i) |
| delete element at pos i More... | |
| T & | at (SLuint i) |
| returns element at pos i More... | |
| void | reverse () |
| reverses the order More... | |
| void | clear () |
| deletes all More... | |
| void | resize (SLuint64 size=0) |
| deletes all, sets _size=size More... | |
| void | reserve (SLuint64 newSize) |
| set capacity = newSize More... | |
Private Attributes | |
| U | _size |
| real size of array of type U More... | |
| U | _capacity |
| internal size of array of type U More... | |
| T * | _contents |
| pointer to the array of type T More... | |
Template class for dynamic vector.
Implements a minimal dynamic sized array like the STL vector. The array can be of a class type T and can have the max. size of type U. Compatibility is given as long no iterators are used. Bounds checks are only done in _DEBUG mode within the access methods and operators.
| SLVector< T, U >::SLVector |
creates empty array
| SLVector< T, U >::SLVector | ( | SLuint | size | ) |
creates array w. size
| SLVector< T, U >::SLVector | ( | const SLVector< T, U > & | a | ) |
creates a copy of array a
returns element at pos i
Returns the element at position i. Overrun is checked in _DEBUG mode and causes Warning but returns a value so that the caller can be reached.
|
inline |
returns internal size
|
inline |
deletes all
| void SLVector< T, U >::erase | ( | U | i | ) |
delete element at pos i
| SLVector< T, U > & SLVector< T, U >::operator= | ( | const SLVector< T, U > & | a | ) |
assignment operator
| SLVector< T, U > & SLVector< T, U >::operator= | ( | const SLVector< T, U > * | a | ) |
assignment operator
access operator
The bracket operator as used in arrays. You can use it on the left or right side of =. Overrun is checked in _DEBUG mode and causes Warning but returns a value so that the caller can be reached.
| void SLVector< T, U >::pop_back |
deletes element at end
| void SLVector< T, U >::push_back | ( | const T | element | ) |
appends element at end
set capacity = newSize
Internal, the SLVector is representet by an c++Array not of size _size, but of an internal size. The function reserve changes the internal representation and can make adding much more faster. If s is smaller than the actual size, it will be ignored.
deletes all, sets _size=size
| void SLVector< T, U >::reverse |
reverses the order
set array with another
|
inline |
returns size
|
private |
internal size of array of type U
|
private |
pointer to the array of type T
|
private |
real size of array of type U