Changeset 284:2d4684f76aac in lemon-0.x for src/include
- Timestamp:
- 04/03/04 20:41:46 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@398
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/include/skeletons/maps.h
r282 r284 11 11 namespace skeleton { 12 12 13 /// Null map concept14 template<typename K, typename T>15 class NullMap16 {17 public:18 /// Map's key type.19 typedef K KeyType;20 /// Map's value type. (The type of objects associated with the keys).21 typedef T ValueType;22 23 /// Facility to define a map with an other value type24 template<typename T1>25 struct rebind {26 /// The type of a map with the given value type27 typedef NullMap<K,T1> other;28 };29 30 NullMap() {}31 };32 33 13 /// Readable map concept 34 14 template<typename K, typename T> 35 class ReadableMap : public NullMap<K,T>15 class ReadableMap 36 16 { 37 17 public: … … 49 29 ReadableMap& operator=(const ReadableMap&) {return *this;} 50 30 51 /// Facility to define a map with an other value type (optional)52 template<typename T1>53 struct rebind {54 /// The type of a map with the given value type55 typedef ReadableMap<K,T1> other;56 };57 /// @brief Constructor that copies all keys from the other map and58 /// assigns to them a default value (optional)59 template<typename T1>60 ReadableMap(const ReadableMap<K,T1> &map, const T1 &v) {}61 62 31 ReadableMap() {} 63 32 }; … … 66 35 /// Writable map concept 67 36 template<typename K, typename T> 68 class WritableMap : public NullMap<K,T>37 class WritableMap 69 38 { 70 39 public: … … 76 45 /// Sets the value associated with a key. 77 46 void set(const KeyType &k,const ValueType &t) {} 78 79 /// Copy contsructor. (optional)80 WritableMap(const WritableMap&) {}81 /// Assignment operator. (optional)82 WritableMap& operator=(const WritableMap&) {return *this;}83 84 /// Facility to define a map with an other value type (optional)85 template<typename T1>86 struct rebind {87 /// The type of a map with the given value type88 typedef WritableMap<K,T1> other;89 };90 /// @brief Constructor that copies all keys from the other map and91 /// assigns to them a default value (optional)92 template<typename T1>93 WritableMap(const WritableMap<K,T1> &map, const T1 &v) {}94 47 95 48 WritableMap() {}
Note: See TracChangeset
for help on using the changeset viewer.