... | ... |
@@ -164,14 +164,14 @@ |
164 | 164 |
///you can specify a default value different from \c Value(). |
165 | 165 |
template <typename K, typename T, typename Compare = std::less<K> > |
166 |
class StdMap { |
|
166 |
class StdMap : public MapBase<K, T> { |
|
167 | 167 |
template <typename K1, typename T1, typename C1> |
168 | 168 |
friend class StdMap; |
169 | 169 |
public: |
170 | 170 |
|
171 |
typedef |
|
171 |
typedef MapBase<K, T> Parent; |
|
172 | 172 |
///\e |
173 |
typedef |
|
173 |
typedef typename Parent::Key Key; |
|
174 | 174 |
///\e |
175 |
typedef |
|
175 |
typedef typename Parent::Value Value; |
|
176 | 176 |
///\e |
177 | 177 |
typedef T& Reference; |
... | ... |
@@ -179,4 +179,6 @@ |
179 | 179 |
typedef const T& ConstReference; |
180 | 180 |
|
181 |
typedef True ReferenceMapTag; |
|
182 |
|
|
181 | 183 |
private: |
182 | 184 |
|
... | ... |
@@ -241,4 +243,25 @@ |
241 | 243 |
}; |
242 | 244 |
|
245 |
///Returns a \ref StdMap class |
|
246 |
|
|
247 |
///This function just returns a \ref StdMap class with specified |
|
248 |
///default value. |
|
249 |
///\relates StdMap |
|
250 |
template<typename K, typename V, typename Compare = std::less<K> > |
|
251 |
inline StdMap<K, V, Compare> stdMap(const V& value = V()) { |
|
252 |
return StdMap<K, V, Compare>(value); |
|
253 |
} |
|
254 |
|
|
255 |
///Returns a \ref StdMap class created from an appropriate std::map |
|
256 |
|
|
257 |
///This function just returns a \ref StdMap class created from an |
|
258 |
///appropriate std::map. |
|
259 |
///\relates StdMap |
|
260 |
template<typename K, typename V, typename Compare = std::less<K> > |
|
261 |
inline StdMap<K, V, Compare> stdMap( const std::map<K, V, Compare> &map, |
|
262 |
const V& value = V() ) { |
|
263 |
return StdMap<K, V, Compare>(map, value); |
|
264 |
} |
|
265 |
|
|
243 | 266 |
/// \brief Map for storing values for keys from the range <tt>[0..size-1]</tt> |
244 | 267 |
/// |
... | ... |
@@ -250,5 +273,5 @@ |
250 | 273 |
/// \todo Revise its name |
251 | 274 |
template <typename T> |
252 |
class IntegerMap { |
|
275 |
class IntegerMap : public MapBase<int, T> { |
|
253 | 276 |
|
254 | 277 |
template <typename T1> |
... | ... |
@@ -257,9 +280,9 @@ |
257 | 280 |
public: |
258 | 281 |
|
259 |
typedef |
|
282 |
typedef MapBase<int, T> Parent; |
|
260 | 283 |
///\e |
261 |
typedef |
|
284 |
typedef typename Parent::Key Key; |
|
262 | 285 |
///\e |
263 |
typedef |
|
286 |
typedef typename Parent::Value Value; |
|
264 | 287 |
///\e |
265 | 288 |
typedef T& Reference; |
... | ... |
@@ -267,4 +290,6 @@ |
267 | 290 |
typedef const T& ConstReference; |
268 | 291 |
|
292 |
typedef True ReferenceMapTag; |
|
293 |
|
|
269 | 294 |
private: |
270 | 295 |
|
... | ... |
@@ -315,4 +340,13 @@ |
315 | 340 |
}; |
316 | 341 |
|
342 |
///Returns an \ref IntegerMap class |
|
343 |
|
|
344 |
///This function just returns an \ref IntegerMap class. |
|
345 |
///\relates IntegerMap |
|
346 |
template<typename T> |
|
347 |
inline IntegerMap<T> integerMap(int size = 0, const T& value = T()) { |
|
348 |
return IntegerMap<T>(size, value); |
|
349 |
} |
|
350 |
|
|
317 | 351 |
/// @} |
318 | 352 |
|
... | ... |
@@ -407,4 +441,13 @@ |
407 | 441 |
}; |
408 | 442 |
|
443 |
///Returns a \ref SimpleMap class |
|
444 |
|
|
445 |
///This function just returns a \ref SimpleMap class. |
|
446 |
///\relates SimpleMap |
|
447 |
template<typename M> |
|
448 |
inline SimpleMap<M> simpleMap(const M &m) { |
|
449 |
return SimpleMap<M>(m); |
|
450 |
} |
|
451 |
|
|
409 | 452 |
///Simple writable wrapping of a map |
410 | 453 |
|
... | ... |
@@ -434,4 +477,13 @@ |
434 | 477 |
}; |
435 | 478 |
|
479 |
///Returns a \ref SimpleWriteMap class |
|
480 |
|
|
481 |
///This function just returns a \ref SimpleWriteMap class. |
|
482 |
///\relates SimpleWriteMap |
|
483 |
template<typename M> |
|
484 |
inline SimpleWriteMap<M> simpleWriteMap(M &m) { |
|
485 |
return SimpleWriteMap<M>(m); |
|
486 |
} |
|
487 |
|
|
436 | 488 |
///Sum of two maps |
437 | 489 |
|
0 comments (0 inline)