Loading...
Searching...
No Matches
CombineMap< M1, M2, F, V > Class Template Reference
Data Structures » Maps » Map Adaptors

## Detailed Description

template<typename M1, typename M2, typename F, typename V = typename F::result_type>
class lemon::CombineMap< M1, M2, F, V >

This read-only map takes two maps and a binary functor and returns the combination of the two given maps using the functor. That is to say, if `m1` is of type `M1` and `m2` is of `M2` and `f` is of `F`, then for

CombineMap<M1,M2,F,V> cm(m1,m2,f);
lemon::CombineMap::CombineMap
CombineMap(const M1 &m1, const M2 &m2, const F &f=F())
Constructor.
Definition maps.h:556

cm[x] will be equal to f(m1[x],m2[x]).

The `Key` type of the map is inherited from `M1` (`M1::Key` must be convertible to `M2::Key`) and the `Value` type is `V`. `M2::Value` and `M1::Value` must be convertible to the corresponding input parameter of `F` and the return type of `F` must be convertible to `V`.

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

See also
  ComposeMap

`#include <lemon/maps.h>`

Inheritance diagram for CombineMap< M1, M2, F, V >:
[legend]

## Public Types

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

## Public Member Functions

| CombineMap (const M1 &m1, const M2 &m2, const F &f=F())
| Constructor.
Value | operator[] (const Key &k) const

## Related Symbols

(Note that these are not member symbols.)
template<typename M1, typename M2, typename F, typename V>
CombineMap< M1, M2, F, V > | combineMap (const M1 &m1, const M2 &m2, const F &f)
| Returns a `CombineMap` class.