gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Small improvements in maps.h - Add a new version of constMap() function. - Fix in FunctorToMap class.
0 2 0
default
2 files changed with 18 insertions and 6 deletions:
↑ Collapse diff ↑
Ignore white space 6 line context
... ...
@@ -118,3 +118,3 @@
118 118
    /// Constructor with specified initial value.
119
    /// \param v is the initial value of the map.
119
    /// \param v The initial value of the map.
120 120
    ConstMap(const Value &v) : _value(v) {}
... ...
@@ -145,2 +145,7 @@
145 145

	
146
  template<typename K, typename V>
147
  inline ConstMap<K, V> constMap() {
148
    return ConstMap<K, V>();
149
  }
150

	
146 151

	
... ...
@@ -615,3 +620,3 @@
615 620
  class FunctorToMap : public MapBase<K, V> {
616
    const F &_f;
621
    F _f;
617 622
  public:
Show white space 6 line context
... ...
@@ -85,2 +85,3 @@
85 85
    checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >();
86
    checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >();
86 87
    ConstMap<A,B> map1;
... ...
@@ -89,3 +90,8 @@
89 90
    map1 = constMap<A>(B());
91
    map1 = constMap<A,B>();
90 92
    map1.setAll(B());
93
    ConstMap<A,C> map4(C(1));
94
    ConstMap<A,C> map5 = map4;
95
    map4 = constMap<A>(C(2));
96
    map4.setAll(C(3));
91 97

	
... ...
@@ -95,6 +101,7 @@
95 101
    checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >();
96
    ConstMap<A,Const<int,10> > map4;
97
    ConstMap<A,Const<int,10> > map5 = map4;
98
    map4 = map5;
99
    check(map4[A()] == 10 && map5[A()] == 10, "Something is wrong with ConstMap");
102
    ConstMap<A,Const<int,10> > map6;
103
    ConstMap<A,Const<int,10> > map7 = map6;
104
    map6 = constMap<A,int,10>();
105
    map7 = constMap<A,Const<int,10> >();
106
    check(map6[A()] == 10 && map7[A()] == 10, "Something is wrong with ConstMap");
100 107
  }
0 comments (0 inline)