AddMap< M1, M2 > Class Template Reference

- Main Page
- Modules
- Classes
- Namespaces
- Files
- Related Pages

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Types | Public Member Functions | Related Functions
AddMap< M1, M2 > Class Template Reference
Map Adaptors

## Detailed Description

### template<typename M1, typename M2>
class lemon::AddMap< M1, M2 >

This read-only map returns the sum of the values of the two given maps. Its `Key` and `Value` types are inherited from `M1`. The `Key` and `Value` of `M2` must be convertible to those of `M1`.

If `m1` is of type `M1` and `m2` is of `M2`, then for

* AddMap<M1,M2> am(m1,m2);
*

`am[x]` will be equal to `m1[x]+m2[x]`.

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

See Also
  SubMap, MulMap, DivMap
  ShiftMap, ShiftWriteMap

`#include <lemon/maps.h>`

Inheritance diagram for AddMap< M1, M2 >:
[legend]

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

## Public Member Functions
| AddMap (const M1 &m1, const M2 &m2)
| Constructor.
Value | operator[] (const Key &k) const

## Related Functions
(Note that these are not member functions.)
template<typename M1 , typename M2 >
AddMap< M1, M2 > | addMap (const M1 &m1, const M2 &m2)
| Returns an `AddMap` class. More...