gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Fixes in the map concepts - Now Value type needn't be default constructible. - Extend the test file to check this.
0 2 0
default
2 files changed with 22 insertions and 9 deletions:
↑ Collapse diff ↑
Show white space 2 line context
... ...
@@ -49,6 +49,5 @@
49 49
      /// Returns the value associated with the given key.
50

	
51
      /// Returns the value associated with the given key.
52
      /// \bug Value shouldn't need to be default constructible. 
53
      Value operator[](const Key &) const { return Value(); }
50
      Value operator[](const Key &) const { 
51
        return *static_cast<Value *>(0);
52
      }
54 53

	
... ...
@@ -128,3 +127,5 @@
128 127
      /// Returns the value associated with the given key.
129
      Value operator[](const Key &) const { return Value(); }
128
      Value operator[](const Key &) const { 
129
        return *static_cast<Value *>(0);
130
      }
130 131

	
... ...
@@ -162,4 +163,2 @@
162 163

	
163
    protected:
164
      Value tmp;
165 164
    public:
... ...
@@ -167,6 +166,10 @@
167 166
      /// Returns a reference to the value associated with the given key.
168
      Reference operator[](const Key &) { return tmp; }
167
      Reference operator[](const Key &) { 
168
        return *static_cast<Value *>(0);
169
      }
169 170

	
170 171
      /// Returns a const reference to the value associated with the given key.
171
      ConstReference operator[](const Key &) const { return tmp; }
172
      ConstReference operator[](const Key &) const {
173
        return *static_cast<Value *>(0);
174
      }
172 175

	
Show white space 2 line context
... ...
@@ -34,2 +34,8 @@
34 34

	
35
class C {
36
  int x;
37
public:
38
  C(int _x) : x(_x) {}
39
};
40

	
35 41
class F {
... ...
@@ -60,5 +66,9 @@
60 66
  checkConcept<ReadMap<A,B>, ReadMap<A,B> >();
67
  checkConcept<ReadMap<A,C>, ReadMap<A,C> >();
61 68
  checkConcept<WriteMap<A,B>, WriteMap<A,B> >();
69
  checkConcept<WriteMap<A,C>, WriteMap<A,C> >();
62 70
  checkConcept<ReadWriteMap<A,B>, ReadWriteMap<A,B> >();
71
  checkConcept<ReadWriteMap<A,C>, ReadWriteMap<A,C> >();
63 72
  checkConcept<ReferenceMap<A,B,B&,const B&>, ReferenceMap<A,B,B&,const B&> >();
73
  checkConcept<ReferenceMap<A,C,C&,const C&>, ReferenceMap<A,C,C&,const C&> >();
64 74

	
0 comments (0 inline)