IterableIntMap
Declared in lemon/maps.h, in the group Graph Maps; the same class on the Doxygen site.
-
template< typename GR , typename K >
class IterableIntMap : protected Type< GR , K > Dynamic iterable integer map.
This class provides a special graph map type which can store an integer value for graph items (
Node,ArcorEdge). For each non-negative value it is possible to iterate on the keys mapped to the value.This map is intended to be used with small integer values, for which it is efficient, and supports iteration only for non-negative values. If you need large values and/or iteration for negative integers, consider to use IterableValueMap instead.
This type is a reference map, so it can be modified with the subscript operator.
See also
See also
Note
The size of the data structure depends on the largest value in the map.
- Template Parameters:
GR – The graph type.
K – The key type of the map (
GR::Node,GR::ArcorGR::Edge).
Public Types
-
typedef int Value
The value type.
-
typedef True ReferenceMapTag
Indicates that the map is reference map.
Public Functions
-
inline explicit IterableIntMap( const Graph & graph )
Constructor of the map. It sets all values to -1.
-
inline explicit IterableIntMap( const Graph & graph , int value )
Constructor of the map with a given value.
-
inline int size() const
Gives back the maximal value plus one.
-
inline LemonRangeWrapper2< ItemIt , IterableIntMap , int > items( int value )
STL style iterator for the keys with the same value.
This is an STL style wrapper for ItemIt. It can be used in range-based for loops, STL algorithms, etc.
Protected Functions
-
inline virtual void clear()
-
class Reference
Reference to the value of the map.
This class is similar to the
inttype. It can be converted tointand it has the same operators.
-
class ItemIt : public Key
Iterator for the keys with the same value. It works like a graph item iterator, it can be converted to the item type of the map, incremented with
++operator, and if the iterator leaves the last valid item, it will be equal toINVALID.Public Functions
-
inline ItemIt(Invalid)
Invalid constructor & conversion.
This constructor initializes the iterator to be invalid.
See also
Invalid for more details.
-
inline ItemIt( const IterableIntMap & map , int value )
Creates an iterator with a value. It iterates on the keys mapped to the given value.
- Parameters:
map – The IterableIntMap.
value – The value.
-
inline ItemIt(Invalid)