sparse_array< I, T > Class Template Reference

#include <sparse_array.h>

Public Types

typedef std::map< I, T > container_type
typedef container_type::size_type size_type

Public Member Functions

operator[] (size_type index) const
T & operator[] (size_type index)
sparse_arrayoperator+= (sparse_array const &rhs)
sparse_arrayoperator-= (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

Detailed Description

template<typename I, typename T>
class sparse_array< I, T >

Definition at line 15 of file sparse_array.h.


Member Typedef Documentation

template<typename I, typename T>
typedef std::map<I, T> sparse_array< I, T >::container_type

Definition at line 17 of file sparse_array.h.

template<typename I, typename T>
typedef container_type::size_type sparse_array< I, T >::size_type

Definition at line 18 of file sparse_array.h.


Member Function Documentation

template<typename I, typename T>
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.

template<typename I, typename T>
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.

template<typename I, typename T>
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.

template<typename I, typename T>
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.

template<typename I, typename T>
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.

template<typename I, typename T>
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.


Field Documentation

template<typename I, typename T>
container_type sparse_array< I, T >::container [private]

The documentation for this class was generated from the following file:

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1