1.1 --- a/src/lemon/concept/maps.h Sat Nov 13 12:53:28 2004 +0000
1.2 +++ b/src/lemon/concept/maps.h Sat Nov 13 17:07:10 2004 +0000
1.3 @@ -36,12 +36,12 @@
1.4 {
1.5 public:
1.6 /// Map's key type.
1.7 - typedef K KeyType;
1.8 + typedef K Key;
1.9 /// Map's value type. (The type of objects associated with the keys).
1.10 - typedef T ValueType;
1.11 + typedef T Value;
1.12
1.13 /// Returns the value associated with a key.
1.14 - ValueType operator[](const KeyType &k) const {return ValueType();}
1.15 + Value operator[](const Key &k) const {return Value();}
1.16
1.17 ///Default constructor
1.18 ReadMap() {}
1.19 @@ -54,12 +54,12 @@
1.20 {
1.21 public:
1.22 /// Map's key type.
1.23 - typedef K KeyType;
1.24 + typedef K Key;
1.25 /// Map's value type. (The type of objects associated with the keys).
1.26 - typedef T ValueType;
1.27 + typedef T Value;
1.28
1.29 /// Sets the value associated with a key.
1.30 - void set(const KeyType &k,const ValueType &t) {}
1.31 + void set(const Key &k,const Value &t) {}
1.32
1.33 ///Default constructor
1.34 WriteMap() {}
1.35 @@ -72,14 +72,14 @@
1.36 {
1.37 public:
1.38 /// Map's key type.
1.39 - typedef K KeyType;
1.40 + typedef K Key;
1.41 /// Map's value type. (The type of objects associated with the keys).
1.42 - typedef T ValueType;
1.43 + typedef T Value;
1.44
1.45 /// Returns the value associated with a key.
1.46 - ValueType operator[](const KeyType &k) const {return ValueType();}
1.47 + Value operator[](const Key &k) const {return Value();}
1.48 /// Sets the value associated with a key.
1.49 - void set(const KeyType &k,const ValueType &t) {}
1.50 + void set(const Key &k,const Value &t) {}
1.51
1.52 ///Default constructor
1.53 ReadWriteMap() {}
1.54 @@ -92,24 +92,24 @@
1.55 {
1.56 public:
1.57 /// Map's key type.
1.58 - typedef K KeyType;
1.59 + typedef K Key;
1.60 /// Map's value type. (The type of objects associated with the keys).
1.61 - typedef T ValueType;
1.62 + typedef T Value;
1.63
1.64 protected:
1.65 - ValueType tmp;
1.66 + Value tmp;
1.67 public:
1.68 - typedef ValueType& ReferenceType;
1.69 + typedef Value& Reference;
1.70 /// Map's const reference type.
1.71 - typedef const ValueType& ConstReferenceType;
1.72 + typedef const Value& ConstReference;
1.73
1.74 ///Returns a reference to the value associated to a key.
1.75 - ReferenceType operator[](const KeyType &i) { return tmp; }
1.76 + Reference operator[](const Key &i) { return tmp; }
1.77 ///Returns a const reference to the value associated to a key.
1.78 - ConstReferenceType operator[](const KeyType &i) const
1.79 + ConstReference operator[](const Key &i) const
1.80 { return tmp; }
1.81 /// Sets the value associated with a key.
1.82 - void set(const KeyType &k,const ValueType &t) { operator[](k)=t; }
1.83 + void set(const Key &k,const Value &t) { operator[](k)=t; }
1.84
1.85 ///Default constructor
1.86 ReferenceMap() {}
1.87 @@ -149,15 +149,15 @@
1.88
1.89 template<typename ReadMap>
1.90 struct ReadMapConcept {
1.91 - typedef typename ReadMap::KeyType KeyType;
1.92 - typedef typename ReadMap::ValueType ValueType;
1.93 + typedef typename ReadMap::Key Key;
1.94 + typedef typename ReadMap::Value Value;
1.95
1.96 void constraints() {
1.97 // No constraints for constructor.
1.98
1.99 - // What are the requirement for the ValueType?
1.100 + // What are the requirement for the Value?
1.101 // CopyConstructible? Assignable? None of these?
1.102 - ValueType v = m[k];
1.103 + Value v = m[k];
1.104 v = m[k];
1.105
1.106 // FIXME:
1.107 @@ -165,13 +165,13 @@
1.108 }
1.109
1.110 ReadMap m;
1.111 - KeyType k;
1.112 + Key k;
1.113 };
1.114
1.115 template<typename WriteMap>
1.116 struct WriteMapConcept {
1.117 - typedef typename WriteMap::KeyType KeyType;
1.118 - typedef typename WriteMap::ValueType ValueType;
1.119 + typedef typename WriteMap::Key Key;
1.120 + typedef typename WriteMap::Value Value;
1.121
1.122 void constraints() {
1.123 // No constraints for constructor.
1.124 @@ -180,8 +180,8 @@
1.125 }
1.126
1.127 WriteMap m;
1.128 - KeyType k;
1.129 - ValueType v;
1.130 + Key k;
1.131 + Value v;
1.132 };
1.133
1.134 template<typename ReadWriteMap>
1.135 @@ -194,12 +194,12 @@
1.136
1.137 template<typename ReferenceMap>
1.138 struct ReferenceMapConcept {
1.139 - typedef typename ReferenceMap::KeyType KeyType;
1.140 - typedef typename ReferenceMap::ValueType ValueType;
1.141 - typedef typename ReferenceMap::ReferenceType ReferenceType;
1.142 + typedef typename ReferenceMap::Key Key;
1.143 + typedef typename ReferenceMap::Value Value;
1.144 + typedef typename ReferenceMap::Reference Reference;
1.145
1.146 // What for is this?
1.147 - typedef typename ReferenceMap::ConstReferenceType ConstReferenceType;
1.148 + typedef typename ReferenceMap::ConstReference ConstReference;
1.149
1.150 void constraints() {
1.151 function_requires< ReadWriteMapConcept<ReferenceMap> >();
1.152 @@ -207,13 +207,13 @@
1.153 m[k] = v;
1.154 // Or should we require real reference?
1.155 // Like this:
1.156 - // ValueType &vv = m[k];
1.157 + // Value &vv = m[k];
1.158 // ignore_unused_variable_warning(vv);
1.159 }
1.160
1.161 ReferenceMap m;
1.162 - KeyType k;
1.163 - ValueType v;
1.164 + Key k;
1.165 + Value v;
1.166 };
1.167
1.168 /// \todo GraphMapConceptCheck
1.169 @@ -235,7 +235,7 @@
1.170 }
1.171 const GraphMap &c;
1.172 const Graph &g;
1.173 - const typename GraphMap::ValueType &t;
1.174 + const typename GraphMap::Value &t;
1.175 };
1.176
1.177