SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
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.
Definition at line 28 of file SLVector.h.
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.
Definition at line 115 of file SLVector.h.
|
inline |
returns internal size
Definition at line 42 of file SLVector.h.
deletes all
Definition at line 48 of file SLVector.h.
SLVector< T, U > & SLVector< T, U >::operator= | ( | const SLVector< T, U > & | a | ) |
assignment operator
Definition at line 129 of file SLVector.h.
SLVector< T, U > & SLVector< T, U >::operator= | ( | const SLVector< T, U > * | a | ) |
assignment operator
Definition at line 137 of file SLVector.h.
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.
Definition at line 96 of file SLVector.h.
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.
Definition at line 175 of file SLVector.h.
|
inline |
returns size
Definition at line 41 of file SLVector.h.
|
private |
internal size of array of type U
Definition at line 54 of file SLVector.h.
|
private |
pointer to the array of type T
Definition at line 55 of file SLVector.h.
|
private |
real size of array of type U
Definition at line 53 of file SLVector.h.