gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge
0 2 0
merge default
0 files changed with 19 insertions and 6 deletions:
↑ Collapse diff ↑
Show white space 16 line context
... ...
@@ -28,18 +28,18 @@
28 28
// Revision History:
29 29
//   05 May   2001: Workarounds for HP aCC from Thomas Matelich. (Jeremy Siek)
30 30
//   02 April 2001: Removed limits header altogether. (Jeremy Siek)
31 31
//   01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
32 32
//
33 33

	
34 34
// See http://www.boost.org/libs/concept_check for documentation.
35 35

	
36
#ifndef LEMON_BOOST_CONCEPT_CHECKS_HPP
37
#define LEMON_BOOST_CONCEPT_CHECKS_HPP
36
#ifndef LEMON_CONCEPT_CHECKS_H
37
#define LEMON_CONCEPT_CHECKS_H
38 38

	
39 39
namespace lemon {
40 40

	
41 41
  /*
42 42
    "inline" is used for ignore_unused_variable_warning()
43 43
    and function_requires() to make sure there is no
44 44
    overtarget with g++.
45 45
  */
... ...
@@ -97,9 +97,9 @@
97 97
  struct concept_checking_##tv1##tv2##tv3##tv4##concept { }; \
98 98
  typedef concept_checking_##tv1##tv2##tv3##tv4##concept< \
99 99
    BOOST_FPTR ns::concept<tv1,tv2,tv3,tv4>::constraints> \
100 100
    concept_checking_typedef_##tv1##tv2##tv3##tv4##concept
101 101

	
102 102

	
103 103
} // namespace lemon
104 104

	
105
#endif // LEMON_BOOST_CONCEPT_CHECKS_HPP
105
#endif // LEMON_CONCEPT_CHECKS_H
Show white space 16 line context
... ...
@@ -29,16 +29,19 @@
29 29
namespace lemon {
30 30

	
31 31
  namespace concepts {
32 32
  
33 33
    /// \addtogroup concept
34 34
    /// @{
35 35

	
36 36
    /// Readable map concept
37

	
38
    /// Readable map concept.
39
    ///
37 40
    template<typename K, typename T>
38 41
    class ReadMap
39 42
    {
40 43
    public:
41 44
      /// Map's key type.
42 45
      typedef K Key;    
43 46
      /// Map's value type. (The type of objects associated with the keys).
44 47
      typedef T Value;
... ...
@@ -66,16 +69,19 @@
66 69
	typename _ReadMap::Key& own_key;
67 70
	_ReadMap& m;
68 71
      };
69 72
      
70 73
    };
71 74

	
72 75

	
73 76
    /// Writable map concept
77
    
78
    /// Writable map concept.
79
    ///
74 80
    template<typename K, typename T>
75 81
    class WriteMap
76 82
    {
77 83
    public:
78 84
      /// Map's key type.
79 85
      typedef K Key;    
80 86
      /// Map's value type. (The type of objects associated with the keys).
81 87
      typedef T Value;
... ...
@@ -103,16 +109,19 @@
103 109
	Key& key;
104 110
	typename _WriteMap::Key& own_key;
105 111
	_WriteMap& m;
106 112

	
107 113
      };
108 114
    };
109 115

	
110 116
    ///Read/Writable map concept
117
    
118
    /// Read/writable map concept.
119
    ///
111 120
    template<typename K, typename T>
112 121
    class ReadWriteMap : public ReadMap<K,T>,
113 122
			    public WriteMap<K,T>
114 123
    {
115 124
    public:
116 125
      /// Map's key type.
117 126
      typedef K Key;    
118 127
      /// Map's value type. (The type of objects associated with the keys).
... ...
@@ -129,16 +138,19 @@
129 138
	  checkConcept<ReadMap<K, T>, _ReadWriteMap >();
130 139
	  checkConcept<WriteMap<K, T>, _ReadWriteMap >();
131 140
	}
132 141
      };
133 142
    };
134 143
  
135 144
  
136 145
    ///Dereferable map concept
146
    
147
    /// Dereferable map concept.
148
    ///
137 149
    template<typename K, typename T, typename R, typename CR>
138 150
    class ReferenceMap : public ReadWriteMap<K,T>
139 151
    {
140 152
    public:
141 153
      /// Tag for reference maps.
142 154
      typedef True ReferenceMapTag;
143 155
      /// Map's key type.
144 156
      typedef K Key;    
... ...
@@ -151,22 +163,21 @@
151 163

	
152 164
    protected:
153 165
      Value tmp;
154 166
    public:
155 167

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

	
164
      // \todo rethink this concept
175
      /// \todo Rethink this concept. 
165 176
      template<typename _ReferenceMap>
166 177
      struct ReferenceMapConcept {
167 178

	
168 179
	void constraints() {
169 180
	  checkConcept<ReadWriteMap, _ReferenceMap >();
170 181
	  m[key] = val;
171 182
	  val  = m[key];
172 183
	  m[key] = ref;
... ...
@@ -185,10 +196,12 @@
185 196
	Reference& ref;
186 197
	_ReferenceMap& m;
187 198
      };
188 199
    };
189 200

	
190 201
    // @}
191 202

	
192 203
  } //namespace concepts
204

	
193 205
} //namespace lemon
206

	
194 207
#endif // LEMON_CONCEPT_MAPS_H
0 comments (0 inline)