0
2
0
119
63
... | ... |
@@ -50,2 +50,3 @@ |
50 | 50 |
|
51 |
/// Returns the value associated with a key. |
|
51 | 52 |
/// \bug Value shouldn't need to be default constructible. |
... | ... |
@@ -115,3 +116,3 @@ |
115 | 116 |
|
116 |
/// Read/ |
|
117 |
/// Read/writable map concept |
|
117 | 118 |
|
... | ... |
@@ -148,2 +149,3 @@ |
148 | 149 |
/// |
150 |
/// \todo Rethink this concept. |
|
149 | 151 |
template<typename K, typename T, typename R, typename CR> |
... | ... |
@@ -167,5 +169,5 @@ |
167 | 169 |
|
168 |
///Returns a reference to the value associated |
|
170 |
///Returns a reference to the value associated with a key. |
|
169 | 171 |
Reference operator[](const Key &) { return tmp; } |
170 |
///Returns a const reference to the value associated |
|
172 |
///Returns a const reference to the value associated with a key. |
|
171 | 173 |
ConstReference operator[](const Key &) const { return tmp; } |
... | ... |
@@ -174,3 +176,2 @@ |
174 | 176 |
|
175 |
/// \todo Rethink this concept. |
|
176 | 177 |
template<typename _ReferenceMap> |
... | ... |
@@ -83,4 +83,5 @@ |
83 | 83 |
|
84 |
/// This is a readable map which assigns a specified value to each key. |
|
85 |
/// In other aspects it is equivalent to the \c NullMap. |
|
84 |
/// This is a \ref concepts::ReadMap "readable" map which assigns a |
|
85 |
/// specified value to each key. |
|
86 |
/// In other aspects it is equivalent to \c NullMap. |
|
86 | 87 |
template<typename K, typename T> |
... | ... |
@@ -135,4 +136,5 @@ |
135 | 136 |
|
136 |
/// This is a readable map which assigns a specified value to each key. |
|
137 |
/// In other aspects it is equivalent to the \c NullMap. |
|
137 |
/// This is a \ref concepts::ReadMap "readable" map which assigns a |
|
138 |
/// specified value to each key. |
|
139 |
/// In other aspects it is equivalent to \c NullMap. |
|
138 | 140 |
template<typename K, typename V, V v> |
... | ... |
@@ -151,3 +153,3 @@ |
151 | 153 |
|
152 |
///Returns a \c ConstMap class |
|
154 |
///Returns a \c ConstMap class with inlined value |
|
153 | 155 |
|
... | ... |
@@ -160,3 +162,3 @@ |
160 | 162 |
|
161 |
///Map based on std::map |
|
163 |
///Map based on \c std::map |
|
162 | 164 |
|
... | ... |
@@ -164,4 +166,5 @@ |
164 | 166 |
///you can specify a default value different from \c Value(). |
167 |
///It meets the \ref concepts::ReferenceMap "ReferenceMap" concept. |
|
165 | 168 |
template <typename K, typename T, typename Compare = std::less<K> > |
166 |
class StdMap { |
|
169 |
class StdMap : public MapBase<K, T> { |
|
167 | 170 |
template <typename K1, typename T1, typename C1> |
... | ... |
@@ -170,7 +173,7 @@ |
170 | 173 |
|
171 |
typedef |
|
174 |
typedef MapBase<K, T> Parent; |
|
172 | 175 |
///Key type |
173 |
typedef |
|
176 |
typedef typename Parent::Key Key; |
|
174 | 177 |
///Value type |
175 |
typedef |
|
178 |
typedef typename Parent::Value Value; |
|
176 | 179 |
///Reference Type |
... | ... |
@@ -180,2 +183,4 @@ |
180 | 183 |
|
184 |
typedef True ReferenceMapTag; |
|
185 |
|
|
181 | 186 |
private: |
... | ... |
@@ -190,4 +195,4 @@ |
190 | 195 |
StdMap(const T& value = T()) : _value(value) {} |
191 |
/// \brief Constructs the map from an appropriate std::map, and explicitly |
|
192 |
/// specifies a default value. |
|
196 |
/// \brief Constructs the map from an appropriate \c std::map, and |
|
197 |
/// explicitly specifies a default value. |
|
193 | 198 |
template <typename T1, typename Comp1> |
... | ... |
@@ -196,3 +201,3 @@ |
196 | 201 |
|
197 |
/// \brief Constructs a map from an other StdMap. |
|
202 |
/// \brief Constructs a map from an other \ref StdMap. |
|
198 | 203 |
template<typename T1, typename Comp1> |
... | ... |
@@ -241,2 +246,23 @@ |
241 | 246 |
}; |
247 |
|
|
248 |
///Returns a \c StdMap class |
|
249 |
|
|
250 |
///This function just returns a \c StdMap class with specified |
|
251 |
///default value. |
|
252 |
///\relates StdMap |
|
253 |
template<typename K, typename V, typename Compare = std::less<K> > |
|
254 |
inline StdMap<K, V, Compare> stdMap(const V& value = V()) { |
|
255 |
return StdMap<K, V, Compare>(value); |
|
256 |
} |
|
257 |
|
|
258 |
///Returns a \c StdMap class created from an appropriate std::map |
|
259 |
|
|
260 |
///This function just returns a \c StdMap class created from an |
|
261 |
///appropriate std::map. |
|
262 |
///\relates StdMap |
|
263 |
template<typename K, typename V, typename Compare = std::less<K> > |
|
264 |
inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map, |
|
265 |
const V& value = V() ) { |
|
266 |
return StdMap<K, V, Compare>(map, value); |
|
267 |
} |
|
242 | 268 |
|
... | ... |
@@ -244,6 +270,7 @@ |
244 | 270 |
/// |
245 |
/// |
|
271 |
/// This map has the <tt>[0..size-1]</tt> keyset and the values |
|
246 | 272 |
/// are stored in a \c std::vector<T> container. It can be used with |
247 | 273 |
/// some data structures, for example \c UnionFind, \c BinHeap, when |
248 |
/// the used items are small integer numbers. |
|
274 |
/// the used items are small integer numbers. |
|
275 |
/// This map meets the \ref concepts::ReferenceMap "ReferenceMap" concept. |
|
249 | 276 |
/// |
... | ... |
@@ -251,3 +278,3 @@ |
251 | 278 |
template <typename T> |
252 |
class IntegerMap { |
|
279 |
class IntegerMap : public MapBase<int, T> { |
|
253 | 280 |
|
... | ... |
@@ -258,7 +285,7 @@ |
258 | 285 |
|
259 |
typedef |
|
286 |
typedef MapBase<int, T> Parent; |
|
260 | 287 |
///\e |
261 |
typedef |
|
288 |
typedef typename Parent::Key Key; |
|
262 | 289 |
///\e |
263 |
typedef |
|
290 |
typedef typename Parent::Value Value; |
|
264 | 291 |
///\e |
... | ... |
@@ -268,2 +295,4 @@ |
268 | 295 |
|
296 |
typedef True ReferenceMapTag; |
|
297 |
|
|
269 | 298 |
private: |
... | ... |
@@ -278,3 +307,3 @@ |
278 | 307 |
|
279 |
/// \brief Constructs the map from an appropriate std::vector. |
|
308 |
/// \brief Constructs the map from an appropriate \c std::vector. |
|
280 | 309 |
template <typename T1> |
... | ... |
@@ -283,3 +312,3 @@ |
283 | 312 |
|
284 |
/// \brief Constructs a map from an other IntegerMap. |
|
313 |
/// \brief Constructs a map from an other \ref IntegerMap. |
|
285 | 314 |
template <typename T1> |
... | ... |
@@ -315,2 +344,11 @@ |
315 | 344 |
}; |
345 |
|
|
346 |
///Returns an \c IntegerMap class |
|
347 |
|
|
348 |
///This function just returns an \c IntegerMap class. |
|
349 |
///\relates IntegerMap |
|
350 |
template<typename T> |
|
351 |
inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) { |
|
352 |
return IntegerMap<T>(size, value); |
|
353 |
} |
|
316 | 354 |
|
... | ... |
@@ -351,3 +389,3 @@ |
351 | 389 |
/// |
352 |
///This \ |
|
390 |
///This \ref concepts::ReadMap "read only map" |
|
353 | 391 |
///converts the \c Value of a map to type \c T. |
... | ... |
@@ -368,5 +406,3 @@ |
368 | 406 |
|
369 |
/// \brief The subscript operator. |
|
370 |
/// |
|
371 |
/// |
|
407 |
///\e |
|
372 | 408 |
Value operator[](const Key& k) const {return m[k];} |
... | ... |
@@ -407,2 +443,11 @@ |
407 | 443 |
}; |
444 |
|
|
445 |
///Returns a \c SimpleMap class |
|
446 |
|
|
447 |
///This function just returns a \c SimpleMap class. |
|
448 |
///\relates SimpleMap |
|
449 |
template<typename M> |
|
450 |
inline SimpleMap<M> simpleMap(const M &m) { |
|
451 |
return SimpleMap<M>(m); |
|
452 |
} |
|
408 | 453 |
|
... | ... |
@@ -410,3 +455,3 @@ |
410 | 455 |
|
411 |
///This \ref concepts:: |
|
456 |
///This \ref concepts::ReadWriteMap "read-write map" returns the simple |
|
412 | 457 |
///wrapping of the given map. Sometimes the reference maps cannot be |
... | ... |
@@ -435,8 +480,17 @@ |
435 | 480 |
|
481 |
///Returns a \c SimpleWriteMap class |
|
482 |
|
|
483 |
///This function just returns a \c SimpleWriteMap class. |
|
484 |
///\relates SimpleWriteMap |
|
485 |
template<typename M> |
|
486 |
inline SimpleWriteMap<M> simpleWriteMap(M &m) { |
|
487 |
return SimpleWriteMap<M>(m); |
|
488 |
} |
|
489 |
|
|
436 | 490 |
///Sum of two maps |
437 | 491 |
|
438 |
///This \ |
|
492 |
///This \ref concepts::ReadMap "read only map" returns the sum of the two |
|
439 | 493 |
///given maps. |
440 | 494 |
///Its \c Key and \c Value are inherited from \c M1. |
441 |
///The \c Key and \c Value of M2 must be convertible to those of \c M1. |
|
495 |
///The \c Key and \c Value of \c M2 must be convertible to those of \c M1. |
|
442 | 496 |
template<typename M1, typename M2> |
... | ... |
@@ -460,3 +514,3 @@ |
460 | 514 |
///This function just returns an \c AddMap class. |
461 |
///\todo |
|
515 |
///\todo Extend the documentation: how to call these type of functions? |
|
462 | 516 |
/// |
... | ... |
@@ -470,3 +524,3 @@ |
470 | 524 |
|
471 |
///This \ |
|
525 |
///This \ref concepts::ReadMap "read only map" returns the sum of the |
|
472 | 526 |
///given map and a constant value. |
... | ... |
@@ -506,3 +560,3 @@ |
506 | 560 |
|
507 |
///This \ |
|
561 |
///This \ref concepts::ReadWriteMap "read-write map" returns the sum of the |
|
508 | 562 |
///given map and a constant value. It makes also possible to write the map. |
... | ... |
@@ -552,3 +606,3 @@ |
552 | 606 |
|
553 |
///This \ |
|
607 |
///This \ref concepts::ReadMap "read only map" returns the difference |
|
554 | 608 |
///of the values of the two given maps. |
... | ... |
@@ -585,3 +639,3 @@ |
585 | 639 |
|
586 |
///This \ |
|
640 |
///This \ref concepts::ReadMap "read only map" returns the product of the |
|
587 | 641 |
///values of the two given maps. |
... | ... |
@@ -615,3 +669,3 @@ |
615 | 669 |
|
616 |
///This \ |
|
670 |
///This \ref concepts::ReadMap "read only map" returns the value of the |
|
617 | 671 |
///given map multiplied from the left side with a constant value. |
... | ... |
@@ -651,3 +705,3 @@ |
651 | 705 |
|
652 |
///This \ |
|
706 |
///This \ref concepts::ReadWriteMap "read-write map" returns the value of the |
|
653 | 707 |
///given map multiplied from the left side with a constant value. It can |
... | ... |
@@ -699,3 +753,3 @@ |
699 | 753 |
|
700 |
///This \ |
|
754 |
///This \ref concepts::ReadMap "read only map" returns the quotient of the |
|
701 | 755 |
///values of the two given maps. |
... | ... |
@@ -729,3 +783,3 @@ |
729 | 783 |
|
730 |
///This \ |
|
784 |
///This \ref concepts::ReadMap "read only map" returns the composition of |
|
731 | 785 |
///two given maps. |
... | ... |
@@ -780,3 +834,3 @@ |
780 | 834 |
/// |
781 |
///This \ |
|
835 |
///This \ref concepts::ReadMap "read only map" takes two maps and a |
|
782 | 836 |
///binary functor and returns the composition of the two |
... | ... |
@@ -853,3 +907,3 @@ |
853 | 907 |
|
854 |
///This \ |
|
908 |
///This \ref concepts::ReadMap "read only map" returns the negative |
|
855 | 909 |
///value of the value returned by the given map. |
... | ... |
@@ -875,3 +929,3 @@ |
875 | 929 |
|
876 |
///This \ |
|
930 |
///This \ref concepts::ReadWriteMap "read-write map" returns the negative |
|
877 | 931 |
///value of the value returned by the given map. |
... | ... |
@@ -917,3 +971,3 @@ |
917 | 971 |
|
918 |
///This \ |
|
972 |
///This \ref concepts::ReadMap "read only map" returns the absolute value |
|
919 | 973 |
///of the value returned by the given map. |
... | ... |
@@ -951,3 +1005,3 @@ |
951 | 1005 |
|
952 |
///This \ |
|
1006 |
///This \ref concepts::ReadMap "read only map" returns the value |
|
953 | 1007 |
///of a given functor. |
... | ... |
@@ -957,3 +1011,4 @@ |
957 | 1011 |
///In most cases they have to be given explicitly because a |
958 |
///functor typically does not provide |
|
1012 |
///functor typically does not provide \c argument_type and |
|
1013 |
///\c result_type typedefs. |
|
959 | 1014 |
/// |
... | ... |
@@ -982,4 +1037,5 @@ |
982 | 1037 |
/// |
983 |
///It is specialized for adaptable function classes and |
|
984 |
///C++ functions. |
|
1038 |
///This function is specialized for adaptable binary function |
|
1039 |
///classes and C++ functions. |
|
1040 |
/// |
|
985 | 1041 |
///\relates FunctorMap |
... | ... |
@@ -1006,6 +1062,6 @@ |
1006 | 1062 |
///This class Converts a map to an STL style (unary) functor. |
1007 |
/// |
|
1063 |
///That is it provides an <tt>operator()</tt> to read its values. |
|
1008 | 1064 |
/// |
1009 | 1065 |
///For the sake of convenience it also works as |
1010 |
///a ususal \ |
|
1066 |
///a ususal \ref concepts::ReadMap "readable map", |
|
1011 | 1067 |
///i.e. <tt>operator[]</tt> and the \c Key and \c Value typedefs also exist. |
... | ... |
@@ -1041,10 +1097,10 @@ |
1041 | 1097 |
|
1042 |
/// |
|
1098 |
///Just readable version of \ref ForkWriteMap |
|
1043 | 1099 |
|
1044 |
///This map has two \ |
|
1100 |
///This map has two \ref concepts::ReadMap "readable map" |
|
1045 | 1101 |
///parameters and each read request will be passed just to the |
1046 |
///first map. This class is the just readable map type of |
|
1102 |
///first map. This class is the just readable map type of \c ForkWriteMap. |
|
1047 | 1103 |
/// |
1048 | 1104 |
///The \c Key and \c Value are inherited from \c M1. |
1049 |
///The \c Key and \c Value of M2 must be convertible from those of \c M1. |
|
1105 |
///The \c Key and \c Value of \c M2 must be convertible from those of \c M1. |
|
1050 | 1106 |
/// |
... | ... |
@@ -1071,5 +1127,5 @@ |
1071 | 1127 |
|
1072 |
///This map has two \ |
|
1128 |
///This map has two \ref concepts::WriteMap "writable map" |
|
1073 | 1129 |
///parameters and each write request will be passed to both of them. |
1074 |
///If \c M1 is also \ |
|
1130 |
///If \c M1 is also \ref concepts::ReadMap "readable", |
|
1075 | 1131 |
///then the read operations will return the |
... | ... |
@@ -1078,3 +1134,3 @@ |
1078 | 1134 |
///The \c Key and \c Value are inherited from \c M1. |
1079 |
///The \c Key and \c Value of M2 must be convertible from those of \c M1. |
|
1135 |
///The \c Key and \c Value of \c M2 must be convertible from those of \c M1. |
|
1080 | 1136 |
/// |
... | ... |
@@ -1122,5 +1178,5 @@ |
1122 | 1178 |
|
1123 |
///This bool \ |
|
1179 |
///This bool \ref concepts::ReadMap "read only map" returns the |
|
1124 | 1180 |
///logical negation of the value returned by the given map. |
1125 |
///Its \c Key is inherited from \c M, its Value is \c bool. |
|
1181 |
///Its \c Key is inherited from \c M, its \c Value is \c bool. |
|
1126 | 1182 |
/// |
... | ... |
@@ -1143,6 +1199,6 @@ |
1143 | 1199 |
|
1144 |
///This bool \ |
|
1200 |
///This bool \ref concepts::ReadWriteMap "read-write map" returns the |
|
1145 | 1201 |
///logical negation of the value returned by the given map. When it is set, |
1146 | 1202 |
///the opposite value is set to the original map. |
1147 |
///Its \c Key is inherited from \c M, its Value is \c bool. |
|
1203 |
///Its \c Key is inherited from \c M, its \c Value is \c bool. |
|
1148 | 1204 |
/// |
... | ... |
@@ -1211,4 +1267,5 @@ |
1211 | 1267 |
/// |
1212 |
/// Writable bool map for logging each \c true assigned element, i.e it |
|
1213 |
/// copies all the keys set to \c true to the given iterator. |
|
1268 |
/// A \ref concepts::ReadWriteMap "read-write" bool map for logging |
|
1269 |
/// each \c true assigned element, i.e it copies all the keys set |
|
1270 |
/// to \c true to the given iterator. |
|
1214 | 1271 |
/// |
... | ... |
@@ -1217,5 +1274,4 @@ |
1217 | 1274 |
/// |
1218 |
/// The following example shows how you can write the edges found by the Prim |
|
1219 |
/// algorithm directly |
|
1220 |
/// |
|
1275 |
/// The following example shows how you can write the edges found by |
|
1276 |
/// the \ref Prim algorithm directly to the standard output. |
|
1221 | 1277 |
///\code |
0 comments (0 inline)