SparseMap
Declared in lemon/maps.h, in the group Maps; the same class on the Doxygen site.
-
template< typename K , typename V , typename Comp = std::less< K > >
class SparseMap : public lemon::MapBase< K , V > Map type based on
std::map.This map is essentially a wrapper for
std::mapwith addition that you can specify a default value for the keys that are not stored actually. This value can be different from the default contructed value (i.e.Value()). This type conforms to the ReferenceMap concept.This map is useful if a default value should be assigned to most of the keys and different values should be assigned only to a few keys (i.e. the map is “sparse”). The name of this type also refers to this important usage.
Apart form that, this map can be used in many other cases since it is based on
std::map, which is a general associative container. However, keep in mind that it is usually not as efficient as other maps.The simplest way of using this map is through the sparseMap() function.
Public Types
-
typedef True ReferenceMapTag
Public Functions
-
template< typename V1 , typename Comp1 >
inline SparseMap(
) Constructs the map from an appropriate
std::map, and explicitly specifies a default value.
-
template< typename V1 , typename Comp1 >
inline SparseMap(
) Constructs the map from another
SparseMap.
-
inline ConstReference operator[]( const Key & k ) const
-
typedef True ReferenceMapTag