Loading...
Searching...
No Matches
ShiftMap< M, C > Class Template Reference
Data Structures » Maps » Map Adaptors

## Detailed Description

template<typename M, typename C = typename M::Value>
class lemon::ShiftMap< M, C >

This read-only map returns the sum of the given map and a constant value (i.e. it shifts the map with the constant). Its `Key` and `Value` are inherited from `M`.

Actually,

ShiftMap<M> sh(m,v);
lemon::ShiftMap::ShiftMap
ShiftMap(const M &m, const C &v)
Constructor.
Definition maps.h:1016

is equivalent to

ConstMap<M::Key, M::Value> cm(v);
AddMap<M, ConstMap<M::Key, M::Value> > sh(m,cm);
lemon::ConstMap
Constant map.
Definition maps.h:101
lemon::AddMap
Sum of two maps.
Definition maps.h:803

The simplest way of using this map is through the shiftMap() function.

See also
  ShiftWriteMap

`#include <lemon/maps.h>`

Inheritance diagram for ShiftMap< M, C >:
[legend]

## Public Types

typedef M::Key | Key
typedef M::Value | Value
Public Types inherited from MapBase< M::Key, M::Value >
typedef M::Key | Key
| The key type of the map.
typedef M::Value | Value
| The value type of the map. (The type of objects associated with the keys).

## Public Member Functions

| ShiftMap (const M &m, const C &v)
| Constructor.
Value | operator[] (const Key &k) const

## Related Symbols

(Note that these are not member symbols.)
template<typename M, typename C>
ShiftMap< M, C > | shiftMap (const M &m, const C &v)
| Returns a `ShiftMap` class.

## Constructor & Destructor Documentation

## ShiftMap()

template<typename M, typename C = typename M::Value>

ShiftMap | ( | const M & | m,
|  | const C & | v )

inline

Constructor.

Parameters

  m | The undelying map.
  v | The constant value.