abLEMON 1.9.0-101-gccb8629
A maintained fork of LEMON
Loading...
Searching...
No Matches
FunctorToMap< F , K , V > Class Template Reference

Converts an STL style (unary) functor to a map. More...

#include <lemon/maps.h>

Inheritance diagram for FunctorToMap< F , K , V >:

Public Types

typedef K Key
 
typedef V Value
 
Public Types inherited from MapBase< typename F::argument_type , typename F::result_type >
typedef typename F::argument_type 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

 FunctorToMap (const F &f=F())
 Constructor.
Value operator[] (const Key &k) const
 

(Note that these are not member symbols.)

template< typename K , typename V , typename F >
FunctorToMap< F , K , V > functorToMap (const F &f)
 Returns a FunctorToMap class.

Detailed Description

template< typename F , typename K = typename F::argument_type , typename V = typename F::result_type >
class lemon::FunctorToMap< F , K , V >

This read-only map returns the value of a given functor. Actually, it just wraps the functor and provides the Key and Value typedefs.

Template parameters K and V will become its Key and Value. In most cases they have to be given explicitly because a functor typically does not provide argument_type and result_type typedefs. Parameter F is the type of the used functor.

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

See also
MapToFunctor