KrisLibrary  1.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
SparseArray< T > Class Template Reference

A sparse 1D array class. More...

#include <SparseArray.h>

Inheritance diagram for SparseArray< T >:
Math::SparseVectorTemplate< T >

Public Types

typedef std::map< int, T > Storage
 
typedef Storage::iterator iterator
 
typedef Storage::const_iterator const_iterator
 

Public Member Functions

 SparseArray (size_t _n)
 
void resize (size_t _n)
 
void clear ()
 
bool empty () const
 
size_t size () const
 
size_t numEntries () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
iterator insert (int i, const T &t)
 
iterator push_back (int i, const T &t)
 
iterator find (int i)
 
const_iterator find (int i) const
 
bool erase (int i)
 
void erase (const iterator &it)
 
bool isValidIndex (int i) const
 
bool isValid () const
 
bool Read (File &f)
 
bool Write (File &f) const
 

Public Attributes

Storage entries
 
size_t n
 

Detailed Description

template<class T>
class SparseArray< T >

A sparse 1D array class.

Acts just like a map of integers to values.


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