Several doc improvements and fixes in maps.h and concepts/maps.h.
1.1 --- a/lemon/concepts/maps.h Tue Feb 05 11:24:32 2008 +0000
1.2 +++ b/lemon/concepts/maps.h Tue Feb 05 12:41:05 2008 +0000
1.3 @@ -34,17 +34,23 @@
1.4 /// @{
1.5
1.6 /// Readable map concept
1.7 +
1.8 + /// Readable map concept.
1.9 + ///
1.10 template<typename K, typename T>
1.11 class ReadMap
1.12 {
1.13 public:
1.14 - /// Map's key type.
1.15 + /// The key type of the map.
1.16 typedef K Key;
1.17 - /// Map's value type. (The type of objects associated with the keys).
1.18 + /// The value type of the map. (The type of objects associated with the keys).
1.19 typedef T Value;
1.20
1.21 - // \bug Value don't need to be default constructible.
1.22 /// Returns the value associated with a key.
1.23 +
1.24 + /// Returns the value associated with a key.
1.25 + /// \bug Value shouldn't need to be default constructible.
1.26 + ///
1.27 Value operator[](const Key &) const {return Value();}
1.28
1.29 template<typename _ReadMap>
1.30 @@ -69,13 +75,16 @@
1.31
1.32
1.33 /// Writable map concept
1.34 +
1.35 + /// Writable map concept.
1.36 + ///
1.37 template<typename K, typename T>
1.38 class WriteMap
1.39 {
1.40 public:
1.41 - /// Map's key type.
1.42 + /// The key type of the map.
1.43 typedef K Key;
1.44 - /// Map's value type. (The type of objects associated with the keys).
1.45 + /// The value type of the map. (The type of objects associated with the keys).
1.46 typedef T Value;
1.47
1.48 /// Sets the value associated with a key.
1.49 @@ -105,15 +114,18 @@
1.50 };
1.51 };
1.52
1.53 - ///Read/Writable map concept
1.54 + /// Read/writable map concept
1.55 +
1.56 + /// Read/writable map concept.
1.57 + ///
1.58 template<typename K, typename T>
1.59 class ReadWriteMap : public ReadMap<K,T>,
1.60 - public WriteMap<K,T>
1.61 + public WriteMap<K,T>
1.62 {
1.63 public:
1.64 - /// Map's key type.
1.65 + /// The key type of the map.
1.66 typedef K Key;
1.67 - /// Map's value type. (The type of objects associated with the keys).
1.68 + /// The value type of the map. (The type of objects associated with the keys).
1.69 typedef T Value;
1.70
1.71 /// Returns the value associated with a key.
1.72 @@ -132,39 +144,41 @@
1.73
1.74
1.75 ///Dereferable map concept
1.76 +
1.77 + /// Dereferable map concept.
1.78 + ///
1.79 + /// \todo Rethink this concept.
1.80 template<typename K, typename T, typename R, typename CR>
1.81 class ReferenceMap : public ReadWriteMap<K,T>
1.82 {
1.83 public:
1.84 /// Tag for reference maps.
1.85 typedef True ReferenceMapTag;
1.86 - /// Map's key type.
1.87 + /// The key type of the map.
1.88 typedef K Key;
1.89 - /// Map's value type. (The type of objects associated with the keys).
1.90 + /// The value type of the map. (The type of objects associated with the keys).
1.91 typedef T Value;
1.92 - /// Map's reference type.
1.93 + /// The reference type of the map.
1.94 typedef R Reference;
1.95 - /// Map's const reference type.
1.96 + /// The const reference type of the map.
1.97 typedef CR ConstReference;
1.98
1.99 protected:
1.100 Value tmp;
1.101 public:
1.102
1.103 - ///Returns a reference to the value associated to a key.
1.104 + ///Returns a reference to the value associated with a key.
1.105 Reference operator[](const Key &) { return tmp; }
1.106 - ///Returns a const reference to the value associated to a key.
1.107 - ConstReference operator[](const Key &) const
1.108 - { return tmp; }
1.109 + ///Returns a const reference to the value associated with a key.
1.110 + ConstReference operator[](const Key &) const { return tmp; }
1.111 /// Sets the value associated with a key.
1.112 void set(const Key &k,const Value &t) { operator[](k)=t; }
1.113
1.114 - // \todo rethink this concept
1.115 template<typename _ReferenceMap>
1.116 - struct ReferenceMapConcept {
1.117 + struct Constraints {
1.118
1.119 void constraints() {
1.120 - checkConcept<ReadWriteMap, _ReferenceMap >();
1.121 + checkConcept<ReadWriteMap<K, T>, _ReferenceMap >();
1.122 m[key] = val;
1.123 val = m[key];
1.124 m[key] = ref;
1.125 @@ -177,10 +191,10 @@
1.126
1.127 typename _ReferenceMap::Key& own_key;
1.128 typename _ReferenceMap::Value& own_val;
1.129 - typename _ReferenceMap::Reference& own_ref;
1.130 + typename _ReferenceMap::Reference own_ref;
1.131 Key& key;
1.132 Value& val;
1.133 - Reference& ref;
1.134 + Reference ref;
1.135 _ReferenceMap& m;
1.136 };
1.137 };
1.138 @@ -188,5 +202,7 @@
1.139 // @}
1.140
1.141 } //namespace concepts
1.142 +
1.143 } //namespace lemon
1.144 +
1.145 #endif // LEMON_CONCEPT_MAPS_H
2.1 --- a/lemon/maps.h Tue Feb 05 11:24:32 2008 +0000
2.2 +++ b/lemon/maps.h Tue Feb 05 12:41:05 2008 +0000
2.3 @@ -44,17 +44,18 @@
2.4 template<typename K, typename T>
2.5 class MapBase {
2.6 public:
2.7 - ///\e
2.8 + /// The key type of the map.
2.9 typedef K Key;
2.10 - ///\e
2.11 + /// The value type of the map. (The type of objects associated with the keys).
2.12 typedef T Value;
2.13 };
2.14
2.15 /// Null map. (a.k.a. DoNothingMap)
2.16
2.17 - /// If you have to provide a map only for its type definitions,
2.18 - /// or if you have to provide a writable map, but
2.19 - /// data written to it will sent to <tt>/dev/null</tt>...
2.20 + /// This map can be used if you have to provide a map only for
2.21 + /// its type definitions, or if you have to provide a writable map,
2.22 + /// but data written to it is not required (i.e. it will be sent to
2.23 + /// <tt>/dev/null</tt>).
2.24 template<typename K, typename T>
2.25 class NullMap : public MapBase<K, T> {
2.26 public:
2.27 @@ -68,6 +69,10 @@
2.28 void set(const K&, const T&) {}
2.29 };
2.30
2.31 + ///Returns a \c NullMap class
2.32 +
2.33 + ///This function just returns a \c NullMap class.
2.34 + ///\relates NullMap
2.35 template <typename K, typename V>
2.36 NullMap<K, V> nullMap() {
2.37 return NullMap<K, V>();
2.38 @@ -76,8 +81,9 @@
2.39
2.40 /// Constant map.
2.41
2.42 - /// This is a readable map which assigns a specified value to each key.
2.43 - /// In other aspects it is equivalent to the \c NullMap.
2.44 + /// This is a \ref concepts::ReadMap "readable" map which assigns a
2.45 + /// specified value to each key.
2.46 + /// In other aspects it is equivalent to \c NullMap.
2.47 template<typename K, typename T>
2.48 class ConstMap : public MapBase<K, T> {
2.49 private:
2.50 @@ -90,13 +96,15 @@
2.51
2.52 /// Default constructor
2.53
2.54 + /// Default constructor.
2.55 /// The value of the map will be uninitialized.
2.56 /// (More exactly it will be default constructed.)
2.57 ConstMap() {}
2.58 - ///\e
2.59 +
2.60 + /// Constructor with specified initial value
2.61
2.62 - /// \param _v The initial value of the map.
2.63 - ///
2.64 + /// Constructor with specified initial value.
2.65 + /// \param _v is the initial value of the map.
2.66 ConstMap(const T &_v) : v(_v) {}
2.67
2.68 ///\e
2.69 @@ -131,8 +139,9 @@
2.70
2.71 /// Constant map with inlined constant value.
2.72
2.73 - /// This is a readable map which assigns a specified value to each key.
2.74 - /// In other aspects it is equivalent to the \c NullMap.
2.75 + /// This is a \ref concepts::ReadMap "readable" map which assigns a
2.76 + /// specified value to each key.
2.77 + /// In other aspects it is equivalent to \c NullMap.
2.78 template<typename K, typename V, V v>
2.79 class ConstMap<K, Const<V, v> > : public MapBase<K, V> {
2.80 public:
2.81 @@ -147,7 +156,7 @@
2.82 void set(const K&, const V&) { }
2.83 };
2.84
2.85 - ///Returns a \c ConstMap class
2.86 + ///Returns a \c ConstMap class with inlined value
2.87
2.88 ///This function just returns a \c ConstMap class with inlined value.
2.89 ///\relates ConstMap
2.90 @@ -156,25 +165,28 @@
2.91 return ConstMap<K, Const<V, v> >();
2.92 }
2.93
2.94 - ///Map based on std::map
2.95 + ///Map based on \c std::map
2.96
2.97 - ///This is essentially a wrapper for \c std::map. With addition that
2.98 + ///This is essentially a wrapper for \c std::map with addition that
2.99 ///you can specify a default value different from \c Value() .
2.100 + ///It meets the \ref concepts::ReferenceMap "ReferenceMap" concept.
2.101 template <typename K, typename T, typename Compare = std::less<K> >
2.102 - class StdMap {
2.103 + class StdMap : public MapBase<K, T> {
2.104 template <typename K1, typename T1, typename C1>
2.105 friend class StdMap;
2.106 public:
2.107
2.108 + typedef MapBase<K, T> Parent;
2.109 + ///Key type
2.110 + typedef typename Parent::Key Key;
2.111 + ///Value type
2.112 + typedef typename Parent::Value Value;
2.113 + ///Reference Type
2.114 + typedef T& Reference;
2.115 + ///Const reference type
2.116 + typedef const T& ConstReference;
2.117 +
2.118 typedef True ReferenceMapTag;
2.119 - ///\e
2.120 - typedef K Key;
2.121 - ///\e
2.122 - typedef T Value;
2.123 - ///\e
2.124 - typedef T& Reference;
2.125 - ///\e
2.126 - typedef const T& ConstReference;
2.127
2.128 private:
2.129
2.130 @@ -186,13 +198,13 @@
2.131
2.132 /// Constructor with specified default value
2.133 StdMap(const T& value = T()) : _value(value) {}
2.134 - /// \brief Constructs the map from an appropriate std::map, and explicitly
2.135 - /// specifies a default value.
2.136 + /// \brief Constructs the map from an appropriate \c std::map, and
2.137 + /// explicitly specifies a default value.
2.138 template <typename T1, typename Comp1>
2.139 StdMap(const std::map<Key, T1, Comp1> &map, const T& value = T())
2.140 : _map(map.begin(), map.end()), _value(value) {}
2.141
2.142 - /// \brief Constructs a map from an other StdMap.
2.143 + /// \brief Constructs a map from an other \ref StdMap.
2.144 template<typename T1, typename Comp1>
2.145 StdMap(const StdMap<Key, T1, Comp1> &c)
2.146 : _map(c._map.begin(), c._map.end()), _value(c._value) {}
2.147 @@ -242,30 +254,58 @@
2.148 };
2.149 };
2.150
2.151 - /// \brief Map for storing values for the range \c [0..size-1] range keys
2.152 + ///Returns a \c StdMap class
2.153 +
2.154 + ///This function just returns a \c StdMap class with specified
2.155 + ///default value.
2.156 + ///\relates StdMap
2.157 + template<typename K, typename V, typename Compare>
2.158 + inline StdMap<K, V, Compare> stdMap(const V& value = V()) {
2.159 + return StdMap<K, V, Compare>(value);
2.160 + }
2.161 +
2.162 + template<typename K, typename V>
2.163 + inline StdMap<K, V, std::less<K> > stdMap(const V& value = V()) {
2.164 + return StdMap<K, V, std::less<K> >(value);
2.165 + }
2.166 +
2.167 + ///Returns a \c StdMap class created from an appropriate \c std::map
2.168 +
2.169 + ///This function just returns a \c StdMap class created from an
2.170 + ///appropriate \c std::map.
2.171 + ///\relates StdMap
2.172 + template<typename K, typename V, typename Compare>
2.173 + inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map,
2.174 + const V& value = V() ) {
2.175 + return StdMap<K, V, Compare>(map, value);
2.176 + }
2.177 +
2.178 + /// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt>
2.179 ///
2.180 - /// The current map has the \c [0..size-1] keyset and the values
2.181 + /// This map has the <tt>[0..size-1]</tt> keyset and the values
2.182 /// are stored in a \c std::vector<T> container. It can be used with
2.183 /// some data structures, for example \c UnionFind, \c BinHeap, when
2.184 /// the used items are small integer numbers.
2.185 template <typename T>
2.186 - class IntegerMap {
2.187 + class IntegerMap : public MapBase<int, T> {
2.188
2.189 template <typename T1>
2.190 friend class IntegerMap;
2.191
2.192 public:
2.193
2.194 - typedef True ReferenceMapTag;
2.195 + typedef MapBase<int, T> Parent;
2.196 ///\e
2.197 - typedef int Key;
2.198 + typedef typename Parent::Key Key;
2.199 ///\e
2.200 - typedef T Value;
2.201 + typedef typename Parent::Value Value;
2.202 ///\e
2.203 typedef T& Reference;
2.204 ///\e
2.205 typedef const T& ConstReference;
2.206
2.207 + typedef True ReferenceMapTag;
2.208 +
2.209 private:
2.210
2.211 typedef std::vector<T> Vector;
2.212 @@ -276,12 +316,12 @@
2.213 /// Constructor with specified default value
2.214 IntegerMap(int size = 0, const T& value = T()) : _vector(size, value) {}
2.215
2.216 - /// \brief Constructs the map from an appropriate std::vector.
2.217 + /// \brief Constructs the map from an appropriate \c std::vector.
2.218 template <typename T1>
2.219 IntegerMap(const std::vector<T1>& vector)
2.220 : _vector(vector.begin(), vector.end()) {}
2.221
2.222 - /// \brief Constructs a map from an other IntegerMap.
2.223 + /// \brief Constructs a map from an other \ref IntegerMap.
2.224 template <typename T1>
2.225 IntegerMap(const IntegerMap<T1> &c)
2.226 : _vector(c._vector.begin(), c._vector.end()) {}
2.227 @@ -314,14 +354,23 @@
2.228
2.229 };
2.230
2.231 + ///Returns an \c IntegerMap class
2.232 +
2.233 + ///This function just returns an \c IntegerMap class.
2.234 + ///\relates IntegerMap
2.235 + template<typename T>
2.236 + inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) {
2.237 + return IntegerMap<T>(size, value);
2.238 + }
2.239 +
2.240 /// @}
2.241
2.242 /// \addtogroup map_adaptors
2.243 /// @{
2.244
2.245 - /// \brief Identity mapping.
2.246 + /// \brief Identity map.
2.247 ///
2.248 - /// This mapping gives back the given key as value without any
2.249 + /// This map gives back the given key as value without any
2.250 /// modification.
2.251 template <typename T>
2.252 class IdentityMap : public MapBase<T, T> {
2.253 @@ -346,10 +395,11 @@
2.254 }
2.255
2.256
2.257 - ///Convert the \c Value of a map to another type.
2.258 -
2.259 - ///This \c concepts::ReadMap "read only map"
2.260 - ///converts the \c Value of a maps to type \c T.
2.261 + ///\brief Convert the \c Value of a map to another type using
2.262 + ///the default conversion.
2.263 + ///
2.264 + ///This \ref concepts::ReadMap "read only map"
2.265 + ///converts the \c Value of a map to type \c T.
2.266 ///Its \c Key is inherited from \c M.
2.267 template <typename M, typename T>
2.268 class ConvertMap : public MapBase<typename M::Key, T> {
2.269 @@ -365,29 +415,29 @@
2.270 ///\param _m is the underlying map
2.271 ConvertMap(const M &_m) : m(_m) {};
2.272
2.273 - /// \brief The subscript operator.
2.274 - ///
2.275 - /// The subscript operator.
2.276 - /// \param k The key
2.277 - /// \return The target of the edge
2.278 + ///\e
2.279 Value operator[](const Key& k) const {return m[k];}
2.280 };
2.281
2.282 - ///Returns an \c ConvertMap class
2.283 + ///Returns a \c ConvertMap class
2.284
2.285 - ///This function just returns an \c ConvertMap class.
2.286 + ///This function just returns a \c ConvertMap class.
2.287 ///\relates ConvertMap
2.288 template<typename T, typename M>
2.289 inline ConvertMap<M, T> convertMap(const M &m) {
2.290 return ConvertMap<M, T>(m);
2.291 }
2.292
2.293 - ///Simple wrapping of the map
2.294 + ///Simple wrapping of a map
2.295
2.296 - ///This \c concepts::ReadMap "read only map" returns the simple
2.297 + ///This \ref concepts::ReadMap "read only map" returns the simple
2.298 ///wrapping of the given map. Sometimes the reference maps cannot be
2.299 ///combined with simple read maps. This map adaptor wraps the given
2.300 ///map to simple read map.
2.301 + ///
2.302 + ///\sa SimpleWriteMap
2.303 + ///
2.304 + /// \todo Revise the misleading name
2.305 template<typename M>
2.306 class SimpleMap : public MapBase<typename M::Key, typename M::Value> {
2.307 const M& m;
2.308 @@ -403,12 +453,25 @@
2.309 Value operator[](Key k) const {return m[k];}
2.310 };
2.311
2.312 - ///Simple writeable wrapping of the map
2.313 + ///Returns a \c SimpleMap class
2.314
2.315 - ///This \c concepts::ReadMap "read only map" returns the simple
2.316 + ///This function just returns a \c SimpleMap class.
2.317 + ///\relates SimpleMap
2.318 + template<typename M>
2.319 + inline SimpleMap<M> simpleMap(const M &m) {
2.320 + return SimpleMap<M>(m);
2.321 + }
2.322 +
2.323 + ///Simple writable wrapping of a map
2.324 +
2.325 + ///This \ref concepts::ReadWriteMap "read-write map" returns the simple
2.326 ///wrapping of the given map. Sometimes the reference maps cannot be
2.327 ///combined with simple read-write maps. This map adaptor wraps the
2.328 ///given map to simple read-write map.
2.329 + ///
2.330 + ///\sa SimpleMap
2.331 + ///
2.332 + /// \todo Revise the misleading name
2.333 template<typename M>
2.334 class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> {
2.335 M& m;
2.336 @@ -426,12 +489,21 @@
2.337 void set(Key k, const Value& c) { m.set(k, c); }
2.338 };
2.339
2.340 + ///Returns a \c SimpleWriteMap class
2.341 +
2.342 + ///This function just returns a \c SimpleWriteMap class.
2.343 + ///\relates SimpleWriteMap
2.344 + template<typename M>
2.345 + inline SimpleWriteMap<M> simpleWriteMap(M &m) {
2.346 + return SimpleWriteMap<M>(m);
2.347 + }
2.348 +
2.349 ///Sum of two maps
2.350
2.351 - ///This \c concepts::ReadMap "read only map" returns the sum of the two
2.352 - ///given maps. Its \c Key and \c Value will be inherited from \c M1.
2.353 - ///The \c Key and \c Value of M2 must be convertible to those of \c M1.
2.354 -
2.355 + ///This \ref concepts::ReadMap "read only map" returns the sum of the two
2.356 + ///given maps.
2.357 + ///Its \c Key and \c Value are inherited from \c M1.
2.358 + ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
2.359 template<typename M1, typename M2>
2.360 class AddMap : public MapBase<typename M1::Key, typename M1::Value> {
2.361 const M1& m1;
2.362 @@ -461,7 +533,7 @@
2.363
2.364 ///Shift a map with a constant.
2.365
2.366 - ///This \c concepts::ReadMap "read only map" returns the sum of the
2.367 + ///This \ref concepts::ReadMap "read only map" returns the sum of the
2.368 ///given map and a constant value.
2.369 ///Its \c Key and \c Value is inherited from \c M.
2.370 ///
2.371 @@ -469,11 +541,13 @@
2.372 ///\code
2.373 /// ShiftMap<X> sh(x,v);
2.374 ///\endcode
2.375 - ///is equivalent with
2.376 + ///is equivalent to
2.377 ///\code
2.378 /// ConstMap<X::Key, X::Value> c_tmp(v);
2.379 /// AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
2.380 ///\endcode
2.381 + ///
2.382 + ///\sa ShiftWriteMap
2.383 template<typename M, typename C = typename M::Value>
2.384 class ShiftMap : public MapBase<typename M::Key, typename M::Value> {
2.385 const M& m;
2.386 @@ -493,21 +567,13 @@
2.387 Value operator[](Key k) const {return m[k] + v;}
2.388 };
2.389
2.390 - ///Shift a map with a constant.
2.391 + ///Shift a map with a constant (ReadWrite version).
2.392
2.393 - ///This \c concepts::ReadWriteMap "read-write map" returns the sum of the
2.394 + ///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the
2.395 ///given map and a constant value. It makes also possible to write the map.
2.396 - ///Its \c Key and \c Value is inherited from \c M.
2.397 + ///Its \c Key and \c Value are inherited from \c M.
2.398 ///
2.399 - ///Actually,
2.400 - ///\code
2.401 - /// ShiftMap<X> sh(x,v);
2.402 - ///\endcode
2.403 - ///is equivalent with
2.404 - ///\code
2.405 - /// ConstMap<X::Key, X::Value> c_tmp(v);
2.406 - /// AddMap<X, ConstMap<X::Key, X::Value> > sh(x,v);
2.407 - ///\endcode
2.408 + ///\sa ShiftMap
2.409 template<typename M, typename C = typename M::Value>
2.410 class ShiftWriteMap : public MapBase<typename M::Key, typename M::Value> {
2.411 M& m;
2.412 @@ -529,7 +595,7 @@
2.413 void set(Key k, const Value& c) { m.set(k, c - v); }
2.414 };
2.415
2.416 - ///Returns an \c ShiftMap class
2.417 + ///Returns a \c ShiftMap class
2.418
2.419 ///This function just returns an \c ShiftMap class.
2.420 ///\relates ShiftMap
2.421 @@ -538,6 +604,10 @@
2.422 return ShiftMap<M, C>(m,v);
2.423 }
2.424
2.425 + ///Returns a \c ShiftWriteMap class
2.426 +
2.427 + ///This function just returns a \c ShiftWriteMap class.
2.428 + ///\relates ShiftWriteMap
2.429 template<typename M, typename C>
2.430 inline ShiftWriteMap<M, C> shiftMap(M &m,const C &v) {
2.431 return ShiftWriteMap<M, C>(m,v);
2.432 @@ -545,9 +615,9 @@
2.433
2.434 ///Difference of two maps
2.435
2.436 - ///This \c concepts::ReadMap "read only map" returns the difference
2.437 - ///of the values of the two
2.438 - ///given maps. Its \c Key and \c Value will be inherited from \c M1.
2.439 + ///This \ref concepts::ReadMap "read only map" returns the difference
2.440 + ///of the values of the two given maps.
2.441 + ///Its \c Key and \c Value are inherited from \c M1.
2.442 ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
2.443
2.444 template<typename M1, typename M2>
2.445 @@ -577,12 +647,10 @@
2.446
2.447 ///Product of two maps
2.448
2.449 - ///This \c concepts::ReadMap "read only map" returns the product of the
2.450 - ///values of the two
2.451 - ///given
2.452 - ///maps. Its \c Key and \c Value will be inherited from \c M1.
2.453 + ///This \ref concepts::ReadMap "read only map" returns the product of the
2.454 + ///values of the two given maps.
2.455 + ///Its \c Key and \c Value are inherited from \c M1.
2.456 ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
2.457 -
2.458 template<typename M1, typename M2>
2.459 class MulMap : public MapBase<typename M1::Key, typename M1::Value> {
2.460 const M1& m1;
2.461 @@ -607,21 +675,23 @@
2.462 return MulMap<M1, M2>(m1,m2);
2.463 }
2.464
2.465 - ///Scales a maps with a constant.
2.466 + ///Scales a map with a constant.
2.467
2.468 - ///This \c concepts::ReadMap "read only map" returns the value of the
2.469 + ///This \ref concepts::ReadMap "read only map" returns the value of the
2.470 ///given map multiplied from the left side with a constant value.
2.471 - ///Its \c Key and \c Value is inherited from \c M.
2.472 + ///Its \c Key and \c Value are inherited from \c M.
2.473 ///
2.474 ///Actually,
2.475 ///\code
2.476 /// ScaleMap<X> sc(x,v);
2.477 ///\endcode
2.478 - ///is equivalent with
2.479 + ///is equivalent to
2.480 ///\code
2.481 /// ConstMap<X::Key, X::Value> c_tmp(v);
2.482 /// MulMap<X, ConstMap<X::Key, X::Value> > sc(x,v);
2.483 ///\endcode
2.484 + ///
2.485 + ///\sa ScaleWriteMap
2.486 template<typename M, typename C = typename M::Value>
2.487 class ScaleMap : public MapBase<typename M::Key, typename M::Value> {
2.488 const M& m;
2.489 @@ -641,12 +711,15 @@
2.490 Value operator[](Key k) const {return v * m[k];}
2.491 };
2.492
2.493 - ///Scales a maps with a constant.
2.494 + ///Scales a map with a constant (ReadWrite version).
2.495
2.496 - ///This \c concepts::ReadWriteMap "read-write map" returns the value of the
2.497 + ///This \ref concepts::ReadWriteMap "read-write map" returns the value of the
2.498 ///given map multiplied from the left side with a constant value. It can
2.499 - ///be used as write map also if the given multiplier is not zero.
2.500 - ///Its \c Key and \c Value is inherited from \c M.
2.501 + ///also be used as write map if the \c / operator is defined between
2.502 + ///\c Value and \c C and the given multiplier is not zero.
2.503 + ///Its \c Key and \c Value are inherited from \c M.
2.504 + ///
2.505 + ///\sa ScaleMap
2.506 template<typename M, typename C = typename M::Value>
2.507 class ScaleWriteMap : public MapBase<typename M::Key, typename M::Value> {
2.508 M& m;
2.509 @@ -668,15 +741,19 @@
2.510 void set(Key k, const Value& c) { m.set(k, c / v);}
2.511 };
2.512
2.513 - ///Returns an \c ScaleMap class
2.514 + ///Returns a \c ScaleMap class
2.515
2.516 - ///This function just returns an \c ScaleMap class.
2.517 + ///This function just returns a \c ScaleMap class.
2.518 ///\relates ScaleMap
2.519 template<typename M, typename C>
2.520 inline ScaleMap<M, C> scaleMap(const M &m,const C &v) {
2.521 return ScaleMap<M, C>(m,v);
2.522 }
2.523
2.524 + ///Returns a \c ScaleWriteMap class
2.525 +
2.526 + ///This function just returns a \c ScaleWriteMap class.
2.527 + ///\relates ScaleWriteMap
2.528 template<typename M, typename C>
2.529 inline ScaleWriteMap<M, C> scaleMap(M &m,const C &v) {
2.530 return ScaleWriteMap<M, C>(m,v);
2.531 @@ -684,11 +761,10 @@
2.532
2.533 ///Quotient of two maps
2.534
2.535 - ///This \c concepts::ReadMap "read only map" returns the quotient of the
2.536 - ///values of the two
2.537 - ///given maps. Its \c Key and \c Value will be inherited from \c M1.
2.538 + ///This \ref concepts::ReadMap "read only map" returns the quotient of the
2.539 + ///values of the two given maps.
2.540 + ///Its \c Key and \c Value are inherited from \c M1.
2.541 ///The \c Key and \c Value of \c M2 must be convertible to those of \c M1.
2.542 -
2.543 template<typename M1, typename M2>
2.544 class DivMap : public MapBase<typename M1::Key, typename M1::Value> {
2.545 const M1& m1;
2.546 @@ -715,19 +791,20 @@
2.547
2.548 ///Composition of two maps
2.549
2.550 - ///This \c concepts::ReadMap "read only map" returns the composition of
2.551 - ///two
2.552 - ///given maps. That is to say, if \c m1 is of type \c M1 and \c m2 is
2.553 - ///of \c M2,
2.554 + ///This \ref concepts::ReadMap "read only map" returns the composition of
2.555 + ///two given maps.
2.556 + ///That is to say, if \c m1 is of type \c M1 and \c m2 is of \c M2,
2.557 ///then for
2.558 ///\code
2.559 /// ComposeMap<M1, M2> cm(m1,m2);
2.560 ///\endcode
2.561 - /// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>
2.562 + /// <tt>cm[x]</tt> will be equal to <tt>m1[m2[x]]</tt>.
2.563 ///
2.564 - ///Its \c Key is inherited from \c M2 and its \c Value is from
2.565 - ///\c M1.
2.566 - ///The \c M2::Value must be convertible to \c M1::Key.
2.567 + ///Its \c Key is inherited from \c M2 and its \c Value is from \c M1.
2.568 + ///\c M2::Value must be convertible to \c M1::Key.
2.569 + ///
2.570 + ///\sa CombineMap
2.571 + ///
2.572 ///\todo Check the requirements.
2.573 template <typename M1, typename M2>
2.574 class ComposeMap : public MapBase<typename M2::Key, typename M1::Value> {
2.575 @@ -755,27 +832,27 @@
2.576 return ComposeMap<M1, M2>(m1,m2);
2.577 }
2.578
2.579 - ///Combines of two maps using an STL (binary) functor.
2.580 + ///Combine of two maps using an STL (binary) functor.
2.581
2.582 - ///Combines of two maps using an STL (binary) functor.
2.583 + ///Combine of two maps using an STL (binary) functor.
2.584 ///
2.585 - ///
2.586 - ///This \c concepts::ReadMap "read only map" takes two maps and a
2.587 - ///binary functor and returns the composition of
2.588 - ///the two
2.589 + ///This \ref concepts::ReadMap "read only map" takes two maps and a
2.590 + ///binary functor and returns the composition of the two
2.591 ///given maps unsing the functor.
2.592 ///That is to say, if \c m1 and \c m2 is of type \c M1 and \c M2
2.593 - ///and \c f is of \c F,
2.594 - ///then for
2.595 + ///and \c f is of \c F, then for
2.596 ///\code
2.597 /// CombineMap<M1, M2,F,V> cm(m1,m2,f);
2.598 ///\endcode
2.599 /// <tt>cm[x]</tt> will be equal to <tt>f(m1[x],m2[x])</tt>
2.600 ///
2.601 ///Its \c Key is inherited from \c M1 and its \c Value is \c V.
2.602 - ///The \c M2::Value and \c M1::Value must be convertible to the corresponding
2.603 + ///\c M2::Value and \c M1::Value must be convertible to the corresponding
2.604 ///input parameter of \c F and the return type of \c F must be convertible
2.605 ///to \c V.
2.606 + ///
2.607 + ///\sa ComposeMap
2.608 + ///
2.609 ///\todo Check the requirements.
2.610 template<typename M1, typename M2, typename F,
2.611 typename V = typename F::result_type>
2.612 @@ -801,15 +878,15 @@
2.613 ///
2.614 ///For example if \c m1 and \c m2 are both \c double valued maps, then
2.615 ///\code
2.616 - ///combineMap<double>(m1,m2,std::plus<double>())
2.617 + ///combineMap(m1,m2,std::plus<double>())
2.618 ///\endcode
2.619 - ///is equivalent with
2.620 + ///is equivalent to
2.621 ///\code
2.622 ///addMap(m1,m2)
2.623 ///\endcode
2.624 ///
2.625 ///This function is specialized for adaptable binary function
2.626 - ///classes and c++ functions.
2.627 + ///classes and C++ functions.
2.628 ///
2.629 ///\relates CombineMap
2.630 template<typename M1, typename M2, typename F, typename V>
2.631 @@ -832,12 +909,12 @@
2.632
2.633 ///Negative value of a map
2.634
2.635 - ///This \c concepts::ReadMap "read only map" returns the negative
2.636 - ///value of the
2.637 - ///value returned by the
2.638 - ///given map. Its \c Key and \c Value will be inherited from \c M.
2.639 + ///This \ref concepts::ReadMap "read only map" returns the negative
2.640 + ///value of the value returned by the given map.
2.641 + ///Its \c Key and \c Value are inherited from \c M.
2.642 ///The unary \c - operator must be defined for \c Value, of course.
2.643 -
2.644 + ///
2.645 + ///\sa NegWriteMap
2.646 template<typename M>
2.647 class NegMap : public MapBase<typename M::Key, typename M::Value> {
2.648 const M& m;
2.649 @@ -852,13 +929,14 @@
2.650 Value operator[](Key k) const {return -m[k];}
2.651 };
2.652
2.653 - ///Negative value of a map
2.654 + ///Negative value of a map (ReadWrite version)
2.655
2.656 - ///This \c concepts::ReadWriteMap "read-write map" returns the negative
2.657 - ///value of the value returned by the
2.658 - ///given map. Its \c Key and \c Value will be inherited from \c M.
2.659 + ///This \ref concepts::ReadWriteMap "read-write map" returns the negative
2.660 + ///value of the value returned by the given map.
2.661 + ///Its \c Key and \c Value are inherited from \c M.
2.662 ///The unary \c - operator must be defined for \c Value, of course.
2.663 -
2.664 + ///
2.665 + /// \sa NegMap
2.666 template<typename M>
2.667 class NegWriteMap : public MapBase<typename M::Key, typename M::Value> {
2.668 M& m;
2.669 @@ -884,6 +962,10 @@
2.670 return NegMap<M>(m);
2.671 }
2.672
2.673 + ///Returns a \c NegWriteMap class
2.674 +
2.675 + ///This function just returns a \c NegWriteMap class.
2.676 + ///\relates NegWriteMap
2.677 template <typename M>
2.678 inline NegWriteMap<M> negMap(M &m) {
2.679 return NegWriteMap<M>(m);
2.680 @@ -891,12 +973,10 @@
2.681
2.682 ///Absolute value of a map
2.683
2.684 - ///This \c concepts::ReadMap "read only map" returns the absolute value
2.685 - ///of the
2.686 - ///value returned by the
2.687 - ///given map. Its \c Key and \c Value will be inherited
2.688 - ///from <tt>M</tt>. <tt>Value</tt>
2.689 - ///must be comparable to <tt>0</tt> and the unary <tt>-</tt>
2.690 + ///This \ref concepts::ReadMap "read only map" returns the absolute value
2.691 + ///of the value returned by the given map.
2.692 + ///Its \c Key and \c Value are inherited from \c M.
2.693 + ///\c Value must be comparable to \c 0 and the unary \c -
2.694 ///operator must be defined for it, of course.
2.695 ///
2.696 ///\bug We need a unified way to handle the situation below:
2.697 @@ -930,9 +1010,9 @@
2.698
2.699 };
2.700
2.701 - ///Returns a \c AbsMap class
2.702 + ///Returns an \c AbsMap class
2.703
2.704 - ///This function just returns a \c AbsMap class.
2.705 + ///This function just returns an \c AbsMap class.
2.706 ///\relates AbsMap
2.707 template<typename M>
2.708 inline AbsMap<M> absMap(const M &m) {
2.709 @@ -941,15 +1021,18 @@
2.710
2.711 ///Converts an STL style functor to a map
2.712
2.713 - ///This \c concepts::ReadMap "read only map" returns the value
2.714 - ///of a
2.715 - ///given map.
2.716 + ///This \ref concepts::ReadMap "read only map" returns the value
2.717 + ///of a given functor.
2.718 ///
2.719 ///Template parameters \c K and \c V will become its
2.720 - ///\c Key and \c Value. They must be given explicitely
2.721 - ///because a functor does not provide such typedefs.
2.722 + ///\c Key and \c Value.
2.723 + ///In most cases they have to be given explicitly because a
2.724 + ///functor typically does not provide \c argument_type and
2.725 + ///\c result_type typedefs.
2.726 ///
2.727 ///Parameter \c F is the type of the used functor.
2.728 + ///
2.729 + ///\sa MapFunctor
2.730 template<typename F,
2.731 typename K = typename F::argument_type,
2.732 typename V = typename F::result_type>
2.733 @@ -970,8 +1053,9 @@
2.734
2.735 ///This function just returns a \c FunctorMap class.
2.736 ///
2.737 - ///It is specialized for adaptable function classes and
2.738 - ///c++ functions.
2.739 + ///This function is specialized for adaptable binary function
2.740 + ///classes and C++ functions.
2.741 + ///
2.742 ///\relates FunctorMap
2.743 template<typename K, typename V, typename F> inline
2.744 FunctorMap<F, K, V> functorMap(const F &f) {
2.745 @@ -994,11 +1078,13 @@
2.746 ///Converts a map to an STL style (unary) functor
2.747
2.748 ///This class Converts a map to an STL style (unary) functor.
2.749 - ///that is it provides an <tt>operator()</tt> to read its values.
2.750 + ///That is it provides an <tt>operator()</tt> to read its values.
2.751 ///
2.752 ///For the sake of convenience it also works as
2.753 - ///a ususal \c concepts::ReadMap "readable map",
2.754 + ///a ususal \ref concepts::ReadMap "readable map",
2.755 ///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist.
2.756 + ///
2.757 + ///\sa FunctorMap
2.758 template <typename M>
2.759 class MapFunctor : public MapBase<typename M::Key, typename M::Value> {
2.760 const M& m;
2.761 @@ -1027,14 +1113,17 @@
2.762 return MapFunctor<M>(m);
2.763 }
2.764
2.765 - ///Applies all map setting operations to two maps
2.766 + ///Just readable version of \ref ForkWriteMap
2.767
2.768 - ///This map has two \c concepts::ReadMap "readable map"
2.769 + ///This map has two \ref concepts::ReadMap "readable map"
2.770 ///parameters and each read request will be passed just to the
2.771 - ///first map. This class is the just readable map type of the ForkWriteMap.
2.772 + ///first map. This class is the just readable map type of \c ForkWriteMap.
2.773 ///
2.774 - ///The \c Key and \c Value will be inherited from \c M1.
2.775 - ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
2.776 + ///The \c Key and \c Value are inherited from \c M1.
2.777 + ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
2.778 + ///
2.779 + ///\sa ForkWriteMap
2.780 +
2.781 template<typename M1, typename M2>
2.782 class ForkMap : public MapBase<typename M1::Key, typename M1::Value> {
2.783 const M1& m1;
2.784 @@ -1053,14 +1142,16 @@
2.785
2.786 ///Applies all map setting operations to two maps
2.787
2.788 - ///This map has two \c concepts::WriteMap "writable map"
2.789 + ///This map has two \ref concepts::WriteMap "writable map"
2.790 ///parameters and each write request will be passed to both of them.
2.791 - ///If \c M1 is also \c concepts::ReadMap "readable",
2.792 + ///If \c M1 is also \ref concepts::ReadMap "readable",
2.793 ///then the read operations will return the
2.794 ///corresponding values of \c M1.
2.795 ///
2.796 - ///The \c Key and \c Value will be inherited from \c M1.
2.797 - ///The \c Key and \c Value of M2 must be convertible from those of \c M1.
2.798 + ///The \c Key and \c Value are inherited from \c M1.
2.799 + ///The \c Key and \c Value of \c M2 must be convertible from those of \c M1.
2.800 + ///
2.801 + ///\sa ForkMap
2.802 template<typename M1, typename M2>
2.803 class ForkWriteMap : public MapBase<typename M1::Key, typename M1::Value> {
2.804 M1& m1;
2.805 @@ -1078,16 +1169,19 @@
2.806 void set(Key k, const Value &v) {m1.set(k,v); m2.set(k,v);}
2.807 };
2.808
2.809 - ///Returns an \c ForkMap class
2.810 + ///Returns a \c ForkMap class
2.811
2.812 - ///This function just returns an \c ForkMap class.
2.813 - ///
2.814 + ///This function just returns a \c ForkMap class.
2.815 ///\relates ForkMap
2.816 template <typename M1, typename M2>
2.817 inline ForkMap<M1, M2> forkMap(const M1 &m1, const M2 &m2) {
2.818 return ForkMap<M1, M2>(m1,m2);
2.819 }
2.820
2.821 + ///Returns a \c ForkWriteMap class
2.822 +
2.823 + ///This function just returns a \c ForkWriteMap class.
2.824 + ///\relates ForkWriteMap
2.825 template <typename M1, typename M2>
2.826 inline ForkWriteMap<M1, M2> forkMap(M1 &m1, M2 &m2) {
2.827 return ForkWriteMap<M1, M2>(m1,m2);
2.828 @@ -1099,11 +1193,11 @@
2.829
2.830 ///Logical 'not' of a map
2.831
2.832 - ///This bool \c concepts::ReadMap "read only map" returns the
2.833 - ///logical negation of
2.834 - ///value returned by the
2.835 - ///given map. Its \c Key and will be inherited from \c M,
2.836 - ///its Value is <tt>bool</tt>.
2.837 + ///This bool \ref concepts::ReadMap "read only map" returns the
2.838 + ///logical negation of the value returned by the given map.
2.839 + ///Its \c Key is inherited from \c M, its \c Value is \c bool.
2.840 + ///
2.841 + ///\sa NotWriteMap
2.842 template <typename M>
2.843 class NotMap : public MapBase<typename M::Key, bool> {
2.844 const M& m;
2.845 @@ -1118,13 +1212,14 @@
2.846 Value operator[](Key k) const {return !m[k];}
2.847 };
2.848
2.849 - ///Logical 'not' of a map with writing possibility
2.850 + ///Logical 'not' of a map (ReadWrie version)
2.851
2.852 - ///This bool \c concepts::ReadWriteMap "read-write map" returns the
2.853 - ///logical negation of value returned by the given map. When it is set,
2.854 + ///This bool \ref concepts::ReadWriteMap "read-write map" returns the
2.855 + ///logical negation of the value returned by the given map. When it is set,
2.856 ///the opposite value is set to the original map.
2.857 - ///Its \c Key and will be inherited from \c M,
2.858 - ///its Value is <tt>bool</tt>.
2.859 + ///Its \c Key is inherited from \c M, its \c Value is \c bool.
2.860 + ///
2.861 + ///\sa NotMap
2.862 template <typename M>
2.863 class NotWriteMap : public MapBase<typename M::Key, bool> {
2.864 M& m;
2.865 @@ -1150,6 +1245,10 @@
2.866 return NotMap<M>(m);
2.867 }
2.868
2.869 + ///Returns a \c NotWriteMap class
2.870 +
2.871 + ///This function just returns a \c NotWriteMap class.
2.872 + ///\relates NotWriteMap
2.873 template <typename M>
2.874 inline NotWriteMap<M> notMap(M &m) {
2.875 return NotWriteMap<M>(m);
2.876 @@ -1181,16 +1280,17 @@
2.877 }
2.878
2.879
2.880 - /// \brief Writable bool map for store each true assigned elements.
2.881 + /// \brief Writable bool map for logging each \c true assigned element
2.882 ///
2.883 - /// Writable bool map to store each true assigned elements. It will
2.884 - /// copies all the keys set to true to the given iterator.
2.885 + /// A \ref concepts::ReadWriteMap "read-write" bool map for logging
2.886 + /// each \c true assigned element, i.e it copies all the keys set
2.887 + /// to \c true to the given iterator.
2.888 ///
2.889 /// \note The container of the iterator should contain space
2.890 /// for each element.
2.891 ///
2.892 - /// The next example shows how can you write the nodes directly
2.893 - /// to the standard output.
2.894 + /// The following example shows how you can write the edges found by
2.895 + /// the \ref Prim algorithm directly to the standard output.
2.896 ///\code
2.897 /// typedef IdMap<UGraph, UEdge> UEdgeIdMap;
2.898 /// UEdgeIdMap uedgeId(ugraph);
2.899 @@ -1203,6 +1303,10 @@
2.900 ///
2.901 /// prim(ugraph, cost, writerMap);
2.902 ///\endcode
2.903 + ///
2.904 + ///\sa BackInserterBoolMap
2.905 + ///\sa FrontInserterBoolMap
2.906 + ///\sa InserterBoolMap
2.907 template <typename _Iterator,
2.908 typename _Functor =
2.909 _maps_bits::Identity<typename _maps_bits::
2.910 @@ -1220,17 +1324,17 @@
2.911 StoreBoolMap(Iterator it, const Functor& functor = Functor())
2.912 : _begin(it), _end(it), _functor(functor) {}
2.913
2.914 - /// Gives back the given iterator set for the first time.
2.915 + /// Gives back the given iterator set for the first key
2.916 Iterator begin() const {
2.917 return _begin;
2.918 }
2.919
2.920 - /// Gives back the iterator after the last set operation.
2.921 + /// Gives back the the 'after the last' iterator
2.922 Iterator end() const {
2.923 return _end;
2.924 }
2.925
2.926 - /// Setter function of the map
2.927 + /// The \c set function of the map
2.928 void set(const Key& key, Value value) const {
2.929 if (value) {
2.930 *_end++ = _functor(key);
2.931 @@ -1243,26 +1347,30 @@
2.932 Functor _functor;
2.933 };
2.934
2.935 - /// \brief Writable bool map for store each true assigned elements in
2.936 + /// \brief Writable bool map for logging each \c true assigned element in
2.937 /// a back insertable container.
2.938 ///
2.939 - /// Writable bool map for store each true assigned elements in a back
2.940 - /// insertable container. It will push back all the keys set to true into
2.941 - /// the container. It can be used to retrieve the items into a standard
2.942 - /// container. The next example shows how can you store the undirected
2.943 - /// edges in a vector with prim algorithm.
2.944 + /// Writable bool map for logging each \c true assigned element by pushing
2.945 + /// them into a back insertable container.
2.946 + /// It can be used to retrieve the items into a standard
2.947 + /// container. The next example shows how you can store the
2.948 + /// edges found by the Prim algorithm in a vector.
2.949 ///
2.950 ///\code
2.951 /// vector<UEdge> span_tree_uedges;
2.952 /// BackInserterBoolMap<vector<UEdge> > inserter_map(span_tree_uedges);
2.953 /// prim(ugraph, cost, inserter_map);
2.954 ///\endcode
2.955 + ///
2.956 + ///\sa StoreBoolMap
2.957 + ///\sa FrontInserterBoolMap
2.958 + ///\sa InserterBoolMap
2.959 template <typename Container,
2.960 typename Functor =
2.961 _maps_bits::Identity<typename Container::value_type> >
2.962 class BackInserterBoolMap {
2.963 public:
2.964 - typedef typename Container::value_type Key;
2.965 + typedef typename Functor::argument_type Key;
2.966 typedef bool Value;
2.967
2.968 /// Constructor
2.969 @@ -1270,7 +1378,7 @@
2.970 const Functor& _functor = Functor())
2.971 : container(_container), functor(_functor) {}
2.972
2.973 - /// Setter function of the map
2.974 + /// The \c set function of the map
2.975 void set(const Key& key, Value value) {
2.976 if (value) {
2.977 container.push_back(functor(key));
2.978 @@ -1282,18 +1390,22 @@
2.979 Functor functor;
2.980 };
2.981
2.982 - /// \brief Writable bool map for store each true assigned elements in
2.983 + /// \brief Writable bool map for logging each \c true assigned element in
2.984 /// a front insertable container.
2.985 ///
2.986 - /// Writable bool map for store each true assigned elements in a front
2.987 - /// insertable container. It will push front all the keys set to \c true into
2.988 - /// the container. For example see the BackInserterBoolMap.
2.989 + /// Writable bool map for logging each \c true assigned element by pushing
2.990 + /// them into a front insertable container.
2.991 + /// It can be used to retrieve the items into a standard
2.992 + /// container. For example see \ref BackInserterBoolMap.
2.993 + ///
2.994 + ///\sa BackInserterBoolMap
2.995 + ///\sa InserterBoolMap
2.996 template <typename Container,
2.997 typename Functor =
2.998 _maps_bits::Identity<typename Container::value_type> >
2.999 class FrontInserterBoolMap {
2.1000 public:
2.1001 - typedef typename Container::value_type Key;
2.1002 + typedef typename Functor::argument_type Key;
2.1003 typedef bool Value;
2.1004
2.1005 /// Constructor
2.1006 @@ -1301,10 +1413,10 @@
2.1007 const Functor& _functor = Functor())
2.1008 : container(_container), functor(_functor) {}
2.1009
2.1010 - /// Setter function of the map
2.1011 + /// The \c set function of the map
2.1012 void set(const Key& key, Value value) {
2.1013 if (value) {
2.1014 - container.push_front(key);
2.1015 + container.push_front(functor(key));
2.1016 }
2.1017 }
2.1018
2.1019 @@ -1313,12 +1425,14 @@
2.1020 Functor functor;
2.1021 };
2.1022
2.1023 - /// \brief Writable bool map for store each true assigned elements in
2.1024 + /// \brief Writable bool map for storing each \c true assigned element in
2.1025 /// an insertable container.
2.1026 ///
2.1027 - /// Writable bool map for store each true assigned elements in an
2.1028 + /// Writable bool map for storing each \c true assigned element in an
2.1029 /// insertable container. It will insert all the keys set to \c true into
2.1030 - /// the container. If you want to store the cut edges of the strongly
2.1031 + /// the container.
2.1032 + ///
2.1033 + /// For example, if you want to store the cut arcs of the strongly
2.1034 /// connected components in a set you can use the next code:
2.1035 ///
2.1036 ///\code
2.1037 @@ -1326,6 +1440,9 @@
2.1038 /// InserterBoolMap<set<Edge> > inserter_map(cut_edges);
2.1039 /// stronglyConnectedCutEdges(graph, cost, inserter_map);
2.1040 ///\endcode
2.1041 + ///
2.1042 + ///\sa BackInserterBoolMap
2.1043 + ///\sa FrontInserterBoolMap
2.1044 template <typename Container,
2.1045 typename Functor =
2.1046 _maps_bits::Identity<typename Container::value_type> >
2.1047 @@ -1334,19 +1451,29 @@
2.1048 typedef typename Container::value_type Key;
2.1049 typedef bool Value;
2.1050
2.1051 - /// Constructor
2.1052 + /// Constructor with specified iterator
2.1053 +
2.1054 + /// Constructor with specified iterator.
2.1055 + /// \param _container The container for storing the elements.
2.1056 + /// \param _it The elements will be inserted before this iterator.
2.1057 + /// \param _functor The functor that is used when an element is stored.
2.1058 InserterBoolMap(Container& _container, typename Container::iterator _it,
2.1059 const Functor& _functor = Functor())
2.1060 : container(_container), it(_it), functor(_functor) {}
2.1061
2.1062 /// Constructor
2.1063 +
2.1064 + /// Constructor without specified iterator.
2.1065 + /// The elements will be inserted before <tt>_container.end()</tt>.
2.1066 + /// \param _container The container for storing the elements.
2.1067 + /// \param _functor The functor that is used when an element is stored.
2.1068 InserterBoolMap(Container& _container, const Functor& _functor = Functor())
2.1069 : container(_container), it(_container.end()), functor(_functor) {}
2.1070
2.1071 - /// Setter function of the map
2.1072 + /// The \c set function of the map
2.1073 void set(const Key& key, Value value) {
2.1074 if (value) {
2.1075 - it = container.insert(it, key);
2.1076 + it = container.insert(it, functor(key));
2.1077 ++it;
2.1078 }
2.1079 }
2.1080 @@ -1357,13 +1484,13 @@
2.1081 Functor functor;
2.1082 };
2.1083
2.1084 - /// \brief Fill the true set elements with a given value.
2.1085 + /// \brief Writable bool map for filling each \c true assigned element with a
2.1086 + /// given value.
2.1087 ///
2.1088 - /// Writable bool map to fill the elements set to \c true with a given value.
2.1089 - /// The value can set
2.1090 - /// the container.
2.1091 + /// Writable bool map for filling each \c true assigned element with a
2.1092 + /// given value. The value can set the container.
2.1093 ///
2.1094 - /// The next code finds the connected components of the undirected graph
2.1095 + /// The following code finds the connected components of a graph
2.1096 /// and stores it in the \c comp map:
2.1097 ///\code
2.1098 /// typedef UGraph::NodeMap<int> ComponentMap;
2.1099 @@ -1411,7 +1538,7 @@
2.1100 fill = _fill;
2.1101 }
2.1102
2.1103 - /// Setter function of the map
2.1104 + /// The \c set function of the map
2.1105 void set(const Key& key, Value value) {
2.1106 if (value) {
2.1107 map.set(key, fill);
2.1108 @@ -1424,11 +1551,12 @@
2.1109 };
2.1110
2.1111
2.1112 - /// \brief Writable bool map which stores for each true assigned elements
2.1113 - /// the setting order number.
2.1114 + /// \brief Writable bool map for storing the sequence number of
2.1115 + /// \c true assignments.
2.1116 ///
2.1117 - /// Writable bool map which stores for each true assigned elements
2.1118 - /// the setting order number. It make easy to calculate the leaving
2.1119 + /// Writable bool map that stores for each \c true assigned elements
2.1120 + /// the sequence number of this setting.
2.1121 + /// It makes it easy to calculate the leaving
2.1122 /// order of the nodes in the \c Dfs algorithm.
2.1123 ///
2.1124 ///\code
2.1125 @@ -1447,9 +1575,9 @@
2.1126 /// }
2.1127 ///\endcode
2.1128 ///
2.1129 - /// The discovering order can be stored a little harder because the
2.1130 + /// The storing of the discovering order is more difficult because the
2.1131 /// ReachedMap should be readable in the dfs algorithm but the setting
2.1132 - /// order map is not readable. Now we should use the fork map:
2.1133 + /// order map is not readable. Thus we must use the fork map:
2.1134 ///
2.1135 ///\code
2.1136 /// typedef Graph::NodeMap<int> OrderMap;
2.1137 @@ -1487,7 +1615,7 @@
2.1138 return counter;
2.1139 }
2.1140
2.1141 - /// Setter function of the map
2.1142 + /// The \c set function of the map
2.1143 void set(const Key& key, Value value) {
2.1144 if (value) {
2.1145 map.set(key, counter++);