Changeset 2248:1ac928089d68 in lemon-0.x
- Timestamp:
- 10/17/06 13:01:16 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2998
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/maps.h
r2093 r2248 288 288 } 289 289 290 ///Simple wrapping of the map 291 292 ///This \ref concept::ReadMap "read only map" returns the simple 293 ///wrapping of the given map. Sometimes the reference maps cannot be 294 ///combined with simple read maps. This map adaptor wraps the given 295 ///map to simple read map. 296 template<typename M> 297 class SimpleMap : public MapBase<typename M::Key, typename M::Value> { 298 const M& m; 299 300 public: 301 typedef MapBase<typename M::Key, typename M::Value> Parent; 302 typedef typename Parent::Key Key; 303 typedef typename Parent::Value Value; 304 305 ///Constructor 306 SimpleMap(const M &_m) : m(_m) {}; 307 Value operator[](Key k) const {return m[k];} 308 }; 309 310 ///Simple writeable wrapping of the map 311 312 ///This \ref concept::ReadMap "read only map" returns the simple 313 ///wrapping of the given map. Sometimes the reference maps cannot be 314 ///combined with simple read-write maps. This map adaptor wraps the 315 ///given map to simple read-write map. 316 template<typename M> 317 class SimpleWriteMap : public MapBase<typename M::Key, typename M::Value> { 318 M& m; 319 320 public: 321 typedef MapBase<typename M::Key, typename M::Value> Parent; 322 typedef typename Parent::Key Key; 323 typedef typename Parent::Value Value; 324 325 ///Constructor 326 SimpleWriteMap(M &_m) : m(_m) {}; 327 Value operator[](Key k) const {return m[k];} 328 void set(Key k, const Value& c) { m.set(k, c); } 329 }; 330 290 331 ///Sum of two maps 291 332
Note: See TracChangeset
for help on using the changeset viewer.