#include <base_types_array.hh>
Public Types | |
| typedef T | Type |
Public Member Functions | |
| SmallArray (const uint varSize=0) | |
| SmallArray (const SmallArray< FIXED_SIZE, T > &src) | |
| Copy constructor. | |
| T & | operator[] (uint i) |
| const T & | operator[] (uint i) const |
| SmallArray < FIXED_SIZE, T > & | operator= (const SmallArray< FIXED_SIZE, T > &src) |
| Amazing that a C++ compiler will accept how this type is written. | |
| bool | operator== (const SmallArray< FIXED_SIZE, T > &src) const |
| bool | operator!= (const SmallArray< FIXED_SIZE, T > &src) const |
| bool | operator< (const SmallArray< FIXED_SIZE, T > &src) const |
| T * | PTR (void) const |
| const T * | CONST_PTR (void) const |
| uint | size (void) const |
| Limited STL compatibility. | |
| void | resize (const uint varSize) |
| void | clear (void) |
| bool | empty (void) const |
| void | push_back (T item) |
Private Attributes | |
| uint | mVarSize |
| T | mArray [FIXED_SIZE] |
Limited-use (for speed/memory optimization).
Like TinyArray, SmallArray's underlying array really is fixed-size, but SmallArray pretends to have variable-size which allows push_back(), size(), resize(). SmallArray's advantage over STL vector is reduced memory consumption and allocation.
NOTE: resize() will fail if new size is beyond fixed-size.
Usage: ------ This pre-allocates space for 256 elements (FIXED-SIZE). But its VARIABLE-SIZE is zero: empty() and size() indicate zero elements!
SmallArray<256,int> array; if ( array.empty() ) Func(); // yes, Func() will be called
Idiom: SmallArray<1000,int> array( 1000 ); // fixed-size = variable-size
| typedef T base::SmallArray< FIXED_SIZE, T >::Type |
| base::SmallArray< FIXED_SIZE, T >::SmallArray | ( | const uint | varSize = 0 |
) | [inline] |
| base::SmallArray< FIXED_SIZE, T >::SmallArray | ( | const SmallArray< FIXED_SIZE, T > & | src | ) | [inline] |
Copy constructor.
| T& base::SmallArray< FIXED_SIZE, T >::operator[] | ( | uint | i | ) | [inline] |
Catching access to an uninitialized element would be ideal but there's no way to tell if the element is being read or written.
| const T& base::SmallArray< FIXED_SIZE, T >::operator[] | ( | uint | i | ) | const [inline] |
| SmallArray<FIXED_SIZE,T>& base::SmallArray< FIXED_SIZE, T >::operator= | ( | const SmallArray< FIXED_SIZE, T > & | src | ) | [inline] |
Amazing that a C++ compiler will accept how this type is written.
| bool base::SmallArray< FIXED_SIZE, T >::operator== | ( | const SmallArray< FIXED_SIZE, T > & | src | ) | const [inline] |
| bool base::SmallArray< FIXED_SIZE, T >::operator!= | ( | const SmallArray< FIXED_SIZE, T > & | src | ) | const [inline] |
| bool base::SmallArray< FIXED_SIZE, T >::operator< | ( | const SmallArray< FIXED_SIZE, T > & | src | ) | const [inline] |
| T* base::SmallArray< FIXED_SIZE, T >::PTR | ( | void | ) | const [inline] |
| const T* base::SmallArray< FIXED_SIZE, T >::CONST_PTR | ( | void | ) | const [inline] |
| uint base::SmallArray< FIXED_SIZE, T >::size | ( | void | ) | const [inline] |
Limited STL compatibility.
| void base::SmallArray< FIXED_SIZE, T >::resize | ( | const uint | varSize | ) | [inline] |
| void base::SmallArray< FIXED_SIZE, T >::clear | ( | void | ) | [inline] |
| bool base::SmallArray< FIXED_SIZE, T >::empty | ( | void | ) | const [inline] |
| void base::SmallArray< FIXED_SIZE, T >::push_back | ( | T | item | ) | [inline] |
uint base::SmallArray< FIXED_SIZE, T >::mVarSize [private] |
T base::SmallArray< FIXED_SIZE, T >::mArray[FIXED_SIZE] [private] |
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:20 2007