#include <sparse_array.h>
Public Types | |
typedef std::map< I, T > | container_type |
typedef container_type::size_type | size_type |
Public Member Functions | |
T | operator[] (size_type index) const |
T & | operator[] (size_type index) |
sparse_array & | operator+= (sparse_array const &rhs) |
sparse_array & | operator-= (sparse_array const &rhs) |
size_type | size () const |
bool | zero () const |
return true if all elements have the default constructed value | |
Private Attributes | |
container_type | container |
Definition at line 15 of file sparse_array.h.
typedef std::map<I, T> sparse_array< I, T >::container_type |
Definition at line 17 of file sparse_array.h.
typedef container_type::size_type sparse_array< I, T >::size_type |
Definition at line 18 of file sparse_array.h.
sparse_array& sparse_array< I, T >::operator+= | ( | sparse_array< I, T > const & | rhs | ) | [inline] |
vectorized += operator
Definition at line 49 of file sparse_array.h.
sparse_array& sparse_array< I, T >::operator-= | ( | sparse_array< I, T > const & | rhs | ) | [inline] |
vectorized -= operator, overflow shouldn't occur during substraction (iow: for each components lhs[i] >= rhs[i]
Definition at line 63 of file sparse_array.h.
T& sparse_array< I, T >::operator[] | ( | size_type | index | ) | [inline] |
Index into the vector for a value. If the index is larger than the current max index, a new array entry is created.
Definition at line 41 of file sparse_array.h.
T sparse_array< I, T >::operator[] | ( | size_type | index | ) | const [inline] |
Index into the map for a value. NOTE: since std::map does/can not have a const member function for operator[], this const member function simply returns 0 for profile classes that aren't represented in the map. This member function will only be invoked for queries of the sparse array.
Definition at line 28 of file sparse_array.h.
size_type sparse_array< I, T >::size | ( | ) | const [inline] |
return the maximum index of the array + 1 or 0 if the array is empty.
Definition at line 77 of file sparse_array.h.
bool sparse_array< I, T >::zero | ( | ) | const [inline] |
return true if all elements have the default constructed value
Definition at line 87 of file sparse_array.h.
container_type sparse_array< I, T >::container [private] |