Changeset 987:87f7c54892df in lemon0.x for src/lemon/concept/maps.h
 Timestamp:
 11/13/04 18:07:10 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1377
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/concept/maps.h
r959 r987 37 37 public: 38 38 /// Map's key type. 39 typedef K Key Type;40 /// Map's value type. (The type of objects associated with the keys). 41 typedef T Value Type;39 typedef K Key; 40 /// Map's value type. (The type of objects associated with the keys). 41 typedef T Value; 42 42 43 43 /// Returns the value associated with a key. 44 Value Type operator[](const KeyType &k) const {return ValueType();}44 Value operator[](const Key &k) const {return Value();} 45 45 46 46 ///Default constructor … … 55 55 public: 56 56 /// Map's key type. 57 typedef K Key Type;58 /// Map's value type. (The type of objects associated with the keys). 59 typedef T Value Type;57 typedef K Key; 58 /// Map's value type. (The type of objects associated with the keys). 59 typedef T Value; 60 60 61 61 /// Sets the value associated with a key. 62 void set(const Key Type &k,const ValueType &t) {}62 void set(const Key &k,const Value &t) {} 63 63 64 64 ///Default constructor … … 73 73 public: 74 74 /// Map's key type. 75 typedef K Key Type;76 /// Map's value type. (The type of objects associated with the keys). 77 typedef T Value Type;75 typedef K Key; 76 /// Map's value type. (The type of objects associated with the keys). 77 typedef T Value; 78 78 79 79 /// Returns the value associated with a key. 80 Value Type operator[](const KeyType &k) const {return ValueType();}80 Value operator[](const Key &k) const {return Value();} 81 81 /// Sets the value associated with a key. 82 void set(const Key Type &k,const ValueType &t) {}82 void set(const Key &k,const Value &t) {} 83 83 84 84 ///Default constructor … … 93 93 public: 94 94 /// Map's key type. 95 typedef K Key Type;96 /// Map's value type. (The type of objects associated with the keys). 97 typedef T Value Type;95 typedef K Key; 96 /// Map's value type. (The type of objects associated with the keys). 97 typedef T Value; 98 98 99 99 protected: 100 Value Typetmp;101 public: 102 typedef Value Type& ReferenceType;100 Value tmp; 101 public: 102 typedef Value& Reference; 103 103 /// Map's const reference type. 104 typedef const Value Type& ConstReferenceType;104 typedef const Value& ConstReference; 105 105 106 106 ///Returns a reference to the value associated to a key. 107 Reference Type operator[](const KeyType&i) { return tmp; }107 Reference operator[](const Key &i) { return tmp; } 108 108 ///Returns a const reference to the value associated to a key. 109 ConstReference Type operator[](const KeyType&i) const109 ConstReference operator[](const Key &i) const 110 110 { return tmp; } 111 111 /// Sets the value associated with a key. 112 void set(const Key Type &k,const ValueType &t) { operator[](k)=t; }112 void set(const Key &k,const Value &t) { operator[](k)=t; } 113 113 114 114 ///Default constructor … … 150 150 template<typename ReadMap> 151 151 struct ReadMapConcept { 152 typedef typename ReadMap::Key Type KeyType;153 typedef typename ReadMap::Value Type ValueType;152 typedef typename ReadMap::Key Key; 153 typedef typename ReadMap::Value Value; 154 154 155 155 void constraints() { 156 156 // No constraints for constructor. 157 157 158 // What are the requirement for the Value Type?158 // What are the requirement for the Value? 159 159 // CopyConstructible? Assignable? None of these? 160 Value Typev = m[k];160 Value v = m[k]; 161 161 v = m[k]; 162 162 … … 166 166 167 167 ReadMap m; 168 Key Typek;168 Key k; 169 169 }; 170 170 171 171 template<typename WriteMap> 172 172 struct WriteMapConcept { 173 typedef typename WriteMap::Key Type KeyType;174 typedef typename WriteMap::Value Type ValueType;173 typedef typename WriteMap::Key Key; 174 typedef typename WriteMap::Value Value; 175 175 176 176 void constraints() { … … 181 181 182 182 WriteMap m; 183 Key Typek;184 Value Typev;183 Key k; 184 Value v; 185 185 }; 186 186 … … 195 195 template<typename ReferenceMap> 196 196 struct ReferenceMapConcept { 197 typedef typename ReferenceMap::Key Type KeyType;198 typedef typename ReferenceMap::Value Type ValueType;199 typedef typename ReferenceMap::Reference Type ReferenceType;197 typedef typename ReferenceMap::Key Key; 198 typedef typename ReferenceMap::Value Value; 199 typedef typename ReferenceMap::Reference Reference; 200 200 201 201 // What for is this? 202 typedef typename ReferenceMap::ConstReference Type ConstReferenceType;202 typedef typename ReferenceMap::ConstReference ConstReference; 203 203 204 204 void constraints() { … … 208 208 // Or should we require real reference? 209 209 // Like this: 210 // Value Type&vv = m[k];210 // Value &vv = m[k]; 211 211 // ignore_unused_variable_warning(vv); 212 212 } 213 213 214 214 ReferenceMap m; 215 Key Typek;216 Value Typev;215 Key k; 216 Value v; 217 217 }; 218 218 … … 236 236 const GraphMap &c; 237 237 const Graph &g; 238 const typename GraphMap::Value Type&t;238 const typename GraphMap::Value &t; 239 239 }; 240 240
Note: See TracChangeset
for help on using the changeset viewer.