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 with some data structures, for example UnionFind
, BinHeap
, when the used items are small integers. This map conforms the ReferenceMap concept.
The simplest way of using this map is through the rangeMap() function.
#include <lemon/maps.h>
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 Types inherited from MapBase< int, V > | |
typedef int | Key |
The key type of the map. | |
typedef V | Value |
The value type of the map. (The type of objects associated with the keys). | |
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 . | |