Public Types | Public Member Functions | Related Functions

CombineMap< M1, M2, F, V > Class Template Reference


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);

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 >:

List of all members.

Public Types

typedef M1::Key Key
 
typedef V Value
 

Public Member Functions

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

Related Functions

(Note that these are not member functions.)
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.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines