This map is essentially a wrapper for std::vector. It assigns values to integer keys from the range [0..size-1]. It can be used together with some data structures, e.g. heap types and UnionFind, when the used items are small integers. This map conforms to the ReferenceMap concept.
The simplest way of using this map is through the rangeMap() function.
#include <lemon/maps.h>
Inheritance diagram for RangeMap< V >:Public Types | |
| typedef int | Key |
| Key type. | |
| typedef V | Value |
| Value type. | |
| typedef Vector::reference | Reference |
| Reference type. | |
| typedef Vector::const_reference | ConstReference |
| Const reference type. | |
Public Member Functions | |
| RangeMap (int size=0, const Value &value=Value()) | |
| Constructor with specified default value. | |
| template<typename V1 > | |
| RangeMap (const std::vector< V1 > &vector) | |
Constructs the map from an appropriate std::vector. | |
| template<typename V1 > | |
| RangeMap (const RangeMap< V1 > &c) | |
Constructs the map from another RangeMap. | |
| int | size () |
| Returns the size of the map. | |
| void | resize (int size, const Value &value=Value()) |
| Resizes the map. | |
| Reference | operator[] (const Key &k) |
| | |
| ConstReference | operator[] (const Key &k) const |
| | |
| void | set (const Key &k, const Value &v) |
| | |
Related Functions | |
| (Note that these are not member functions.) | |
| template<typename V > | |
| RangeMap< V > | rangeMap (int size=0, const V &value=V()) |
Returns a RangeMap class. | |
| template<typename V > | |
| RangeMap< V > | rangeMap (const std::vector< V > &vector) |
Returns a RangeMap class created from an appropriate std::vector. | |
1.7.3