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

Dynamic iterable bool map. More...

#include <lemon/maps.h>

Classes

class  Reference
 Reference to the value of the map. More...
class  TrueIt
 Iterator for the keys mapped to true. More...
class  FalseIt
 Iterator for the keys mapped to false. More...
class  ItemIt
 Iterator for the keys mapped to a given value. More...

Public Types

typedef True ReferenceMapTag
 Indicates that the map is reference map.
typedef K Key
 The key type.
typedef bool Value
 The value type.
typedef const Value & ConstReference
 The const reference type.

Public Member Functions

 IterableBoolMap (const Graph &graph, bool def=false)
 Constructor of the map with a default value.
bool operator[] (const Key &key) const
 Const subscript operator of the map.
Reference operator[] (const Key &key)
 Subscript operator of the map.
void set (const Key &key, bool value)
 Set operation of the map.
void setAll (bool value)
 Set all items.
int trueNum () const
 Returns the number of the keys mapped to true.
int falseNum () const
 Returns the number of the keys mapped to false.
LemonRangeWrapper1< TrueIt , IterableBoolMap > trueKeys ()
 STL style iterator for the keys mapped to true.
LemonRangeWrapper1< FalseIt , IterableBoolMap > falseKeys ()
 STL style iterator for the keys mapped to false.
LemonRangeWrapper2< ItemIt , IterableBoolMap , bool > items (bool value)
 STL style iterator for the keys mapped to a given value.

Detailed Description

template< typename GR , typename K >
class lemon::IterableBoolMap< GR , K >

This class provides a special graph map type which can store a bool value for graph items (Node, Arc or Edge). For both true and false values it is possible to iterate on the keys mapped to the value.

This type is a reference map, so it can be modified with the subscript operator.

Template Parameters
GRThe graph type.
KThe key type of the map (GR::Node, GR::Arc or GR::Edge).
See also
IterableIntMap, IterableValueMap
CrossRefMap

Constructor & Destructor Documentation

◆ IterableBoolMap()

template< typename GR , typename K >
IterableBoolMap ( const Graph & graph,
bool def = false )
inlineexplicit

Constructor of the map with a default value.

Member Function Documentation

◆ operator[]() [1/2]

template< typename GR , typename K >
bool operator[] ( const Key & key) const
inline

Const subscript operator of the map.

◆ operator[]() [2/2]

template< typename GR , typename K >
Reference operator[] ( const Key & key)
inline

Subscript operator of the map.

◆ set()

template< typename GR , typename K >
void set ( const Key & key,
bool value )
inline

Set operation of the map.

◆ setAll()

template< typename GR , typename K >
void setAll ( bool value)
inline

Set all items in the map.

Note
Constant time operation.

◆ trueNum()

template< typename GR , typename K >
int trueNum ( ) const
inline

Returns the number of the keys mapped to true.

◆ falseNum()

template< typename GR , typename K >
int falseNum ( ) const
inline

Returns the number of the keys mapped to false.

◆ trueKeys()

template< typename GR , typename K >
LemonRangeWrapper1< TrueIt , IterableBoolMap > trueKeys ( )
inline

This is an STL style wrapper for TrueIt. It can be used in range-based for loops, STL algorithms, etc.

◆ falseKeys()

template< typename GR , typename K >
LemonRangeWrapper1< FalseIt , IterableBoolMap > falseKeys ( )
inline

This is an STL style wrapper for FalseIt. It can be used in range-based for loops, STL algorithms, etc.

◆ items()

template< typename GR , typename K >
LemonRangeWrapper2< ItemIt , IterableBoolMap , bool > items ( bool value)
inline

This is an STL style wrapper for ItemIt. It can be used in range-based for loops, STL algorithms, etc.