IndexMap<T> implements a generic map indexed by a dynamic index set. More...
#include <IndexMap.h>
Public Member Functions | |
IndexMap () | |
The empty map. | |
IndexMap (IndexMapInit< T > *_init) | |
A map with an initialization object. This associates a method for initializing new elements in the map. When a new index j is added to the index set, an object t of type T is created using the default constructor for T, after which the function _init->init(t) is called (t is passed by reference). To use this feature, you need to derive a subclass of IndexMapInit<T> that defines the init function. This "helper object" should be created using operator new, and the pointer is "exclusively owned" by the map object. | |
const IndexSet & | getIndexSet () const |
Get the underlying index set. | |
T & | operator[] (long j) |
Access functions: will raise an error if j does not belong to the current index set. | |
const T & | operator[] (long j) const |
void | insert (long j) |
Insert indexes to the IndexSet. Insertion will cause new T objects to be created, using the default constructor, and possibly initilized via the IndexMapInit<T> pointer. | |
void | insert (const IndexSet &s) |
void | remove (long j) |
Delete indexes from IndexSet, may cause objects to be destroyed. | |
void | remove (const IndexSet &s) |
void | clear () |
IndexMap<T> implements a generic map indexed by a dynamic index set.
Additionally, it allows new elements of the map to be initialized in a flexible manner.