gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Minor doc improvements.
0 1 0
default
1 file changed with 5 insertions and 4 deletions:
↑ Collapse diff ↑
Ignore white space 32 line context
... ...
@@ -35,32 +35,33 @@
35 35

	
36 36
    /// Readable map concept
37 37

	
38 38
    /// Readable map concept.
39 39
    ///
40 40
    template<typename K, typename T>
41 41
    class ReadMap
42 42
    {
43 43
    public:
44 44
      /// The key type of the map.
45 45
      typedef K Key;    
46 46
      /// The value type of the map. (The type of objects associated with the keys).
47 47
      typedef T Value;
48 48

	
49 49
      /// Returns the value associated with a key.
50 50

	
51
      /// Returns the value associated with a key.
51 52
      /// \bug Value shouldn't need to be default constructible.
52 53
      ///
53 54
      Value operator[](const Key &) const {return Value();}
54 55

	
55 56
      template<typename _ReadMap>
56 57
      struct Constraints {
57 58

	
58 59
	void constraints() {
59 60
	  Value val = m[key];
60 61
	  val = m[key];
61 62
	  typename _ReadMap::Value own_val = m[own_key]; 
62 63
	  own_val = m[own_key]; 
63 64

	
64 65
	  ignore_unused_variable_warning(val);
65 66
	  ignore_unused_variable_warning(own_val);
66 67
	  ignore_unused_variable_warning(key);
... ...
@@ -100,92 +101,92 @@
100 101
	  m.set(own_key, own_val);
101 102
	  ignore_unused_variable_warning(key);
102 103
	  ignore_unused_variable_warning(val);
103 104
	  ignore_unused_variable_warning(own_key);
104 105
	  ignore_unused_variable_warning(own_val);
105 106
	}
106 107

	
107 108
	Value& val;
108 109
	typename _WriteMap::Value own_val;
109 110
	Key& key;
110 111
	typename _WriteMap::Key& own_key;
111 112
	_WriteMap& m;
112 113

	
113 114
      };
114 115
    };
115 116

	
116
    /// Read/Writable map concept
117
    /// Read/writable map concept
117 118
    
118 119
    /// Read/writable map concept.
119 120
    ///
120 121
    template<typename K, typename T>
121 122
    class ReadWriteMap : public ReadMap<K,T>,
122 123
			 public WriteMap<K,T>
123 124
    {
124 125
    public:
125 126
      /// The key type of the map.
126 127
      typedef K Key;    
127 128
      /// The value type of the map. (The type of objects associated with the keys).
128 129
      typedef T Value;
129 130

	
130 131
      /// Returns the value associated with a key.
131 132
      Value operator[](const Key &) const {return Value();}
132 133
      /// Sets the value associated with a key.
133 134
      void set(const Key & ,const Value &) {}
134 135

	
135 136
      template<typename _ReadWriteMap>
136 137
      struct Constraints {
137 138
	void constraints() {
138 139
	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
139 140
	  checkConcept<WriteMap<K, T>, _ReadWriteMap >();
140 141
	}
141 142
      };
142 143
    };
143 144
  
144 145
  
145 146
    /// Dereferable map concept
146 147
    
147 148
    /// Dereferable map concept.
148 149
    ///
150
    /// \todo Rethink this concept.
149 151
    template<typename K, typename T, typename R, typename CR>
150 152
    class ReferenceMap : public ReadWriteMap<K,T>
151 153
    {
152 154
    public:
153 155
      /// Tag for reference maps.
154 156
      typedef True ReferenceMapTag;
155 157
      /// The key type of the map.
156 158
      typedef K Key;    
157 159
      /// The value type of the map. (The type of objects associated with the keys).
158 160
      typedef T Value;
159 161
      /// The reference type of the map.
160 162
      typedef R Reference;
161 163
      /// The const reference type of the map.
162 164
      typedef CR ConstReference;
163 165

	
164 166
    protected:
165 167
      Value tmp;
166 168
    public:
167 169

	
168
      ///Returns a reference to the value associated to a key.
170
      ///Returns a reference to the value associated with a key.
169 171
      Reference operator[](const Key &) { return tmp; }
170
      ///Returns a const reference to the value associated to a key.
172
      ///Returns a const reference to the value associated with a key.
171 173
      ConstReference operator[](const Key &) const { return tmp; }
172 174
      /// Sets the value associated with a key.
173 175
      void set(const Key &k,const Value &t) { operator[](k)=t; }
174 176

	
175
      /// \todo Rethink this concept. 
176 177
      template<typename _ReferenceMap>
177 178
      struct ReferenceMapConcept {
178 179

	
179 180
	void constraints() {
180 181
	  checkConcept<ReadWriteMap, _ReferenceMap >();
181 182
	  m[key] = val;
182 183
	  val  = m[key];
183 184
	  m[key] = ref;
184 185
	  ref = m[key];
185 186
	  m[own_key] = own_val;
186 187
	  own_val  = m[own_key];
187 188
	  m[own_key] = own_ref;
188 189
	  own_ref = m[own_key];	  	  
189 190
	}
190 191

	
191 192
	typename _ReferenceMap::Key& own_key;
0 comments (0 inline)