Changeset 805:59b8cb2cb2f8 in lemon-0.x for src/hugo
- Timestamp:
- 09/06/04 10:22:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1099
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/maps.h
r720 r805 15 15 /// Base class of maps. 16 16 17 /// Base class of maps. 18 /// It provides the necessary <tt>typedef</tt>s required by the map concept. 17 19 template<typename K, typename T> 18 20 class MapBase 19 21 { 20 22 public: 21 /// 23 /// . 22 24 typedef K KeyType; 23 /// 25 /// . 24 26 typedef T ValueType; 25 27 }; 26 28 27 /// Null map. (a kaDoNothingMap)29 /// Null map. (a.k.a. DoNothingMap) 28 30 29 31 /// If you have to provide a map only for its type definitions, 30 /// or if you have to provide a writable map, but will not use the31 /// data written to it ...32 /// or if you have to provide a writable map, but 33 /// data written to it will sent to <tt>/dev/null</tt>... 32 34 template<typename K, typename T> 33 35 class NullMap : public MapBase<K,T> … … 35 37 public: 36 38 39 /// Gives back a default constructed element. 37 40 T operator[](const K&) const { return T(); } 41 /// Absorbs the value. 38 42 void set(const K&, const T&) {} 39 ///\bug when update is removed from map concepts by being dynamic40 ///stuffs, this line have to be removed.41 void update() { }42 43 }; 43 44 … … 45 46 /// Constant map. 46 47 47 /// This is a readable map which assignes a specified value to each key. 48 /// In other aspects it is equivalent to the \ref NullMap 48 /// This is a readable map which assigns a specified value to each key. 49 /// In other aspects it is equivalent to the \ref NullMap. 50 /// \todo set could be used to set the value. 49 51 template<typename K, typename T> 50 52 class ConstMap : public MapBase<K,T> … … 53 55 public: 54 56 57 /// Default constructor 58 59 /// The value of the map will be uninitialized. 60 /// (More exactly it will be default constructed.) 55 61 ConstMap() {} 62 /// . 63 64 /// \param _v The initial value of the map. 56 65 ConstMap(const T &_v) : v(_v) {} 57 66 … … 124 133 /// \return Returns the previous default value. 125 134 /// 126 /// \warning The value of some keys (which has alre dy been queried, but135 /// \warning The value of some keys (which has already been queried, but 127 136 /// the value has been unchanged from the default) may change! 128 137 T setDefault(const T &_v) { T old=v; v=_v; return old; }
Note: See TracChangeset
for help on using the changeset viewer.