Changeset 1805:d284f81f02a5 in lemon0.x for lemon
 Timestamp:
 11/16/05 14:19:05 (14 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2348
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/iterable_maps.h
r1759 r1805 31 31 32 32 ///\todo This is only a static map! 33 ///\todo Undocumented. 33 34 ///\param BaseMap is an interger map. 34 35 template<class BaseMap> … … 64 65 ///\e 65 66 void set(Key k,Value v) { if(v) setTrue(k); else setFalse(k);} 67 ///Number of \c true items in the map 68 69 ///Returns the number of \c true values in the map. 70 ///This is a constant time operation. 71 int countTrue() { return vals.size()sep; } 72 ///Number of \c false items in the map 73 74 ///Returns the number of \c false values in the map. 75 ///This is a constant time operation. 76 int countFalse() { return sep; } 66 77 67 78 ///\e … … 71 82 int i; 72 83 public: 84 ///\e 73 85 explicit FalseIt(const IterableBoolMap &_M) : M(_M), i(0) { } 86 ///\e 74 87 FalseIt(Invalid) 75 88 : M(*((IterableBoolMap*)(0))), i(std::numeric_limits<int>::max()) { } 89 ///\e 76 90 FalseIt &operator++() { ++i; return *this;} 91 ///\e 77 92 operator Key() const { return i<M.sep ? M.vals[i] : INVALID; } 93 ///\e 78 94 bool operator !=(Invalid) const { return i<M.sep; } 95 ///\e 79 96 bool operator ==(Invalid) const { return i>=M.sep; } 80 97 }; … … 85 102 int i; 86 103 public: 104 ///\e 87 105 explicit TrueIt(const IterableBoolMap &_M) 88 106 : M(_M), i(M.vals.size()1) { } 107 ///\e 89 108 TrueIt(Invalid) 90 109 : M(*((IterableBoolMap*)(0))), i(1) { } 110 ///\e 91 111 TrueIt &operator++() { i; return *this;} 112 ///\e 92 113 operator Key() const { return i>=M.sep ? M.vals[i] : INVALID; } 114 ///\e 93 115 bool operator !=(Invalid) const { return i>=M.sep; } 116 ///\e 94 117 bool operator ==(Invalid) const { return i<M.sep; } 95 118 }; … … 123 146 if(init) sep=0; 124 147 } 148 ///\e 125 149 RefType operator[] (Key k) { return RefType(*this,k);} 150 ///\e 126 151 Value operator[] (Key k) const { return isTrue(k);} 127 152 }; … … 164 189 ///\e 165 190 void set(Key k, bool v) { imap.set(k,v);} 191 ///Number of \c true items in the map 192 193 ///Returns the number of \c true values in the map. 194 ///This is a constant time operation. 195 int countTrue() { return imap.countTrue(); } 196 ///Number of \c false items in the map 197 198 ///Returns the number of \c false values in the map. 199 ///This is a constant time operation. 200 int countFalse() { return imap.countFalse(); } 166 201 #ifdef DOXYGEN 167 202 ///\e … … 177 212 { 178 213 public: 214 ///\e 179 215 explicit FalseIt(const IterableBoolNodeMap &m) 180 216 : BimType::FalseIt(m.imap) { } 217 ///\e 181 218 FalseIt(Invalid i) : BimType::FalseIt(i) { } 182 219 }; … … 185 222 { 186 223 public: 224 ///\e 187 225 explicit TrueIt(const IterableBoolNodeMap &m) 188 226 : BimType::TrueIt(m.imap) { } 227 ///\e 189 228 TrueIt(Invalid i) : BimType::TrueIt(i) { } 190 229 }; … … 222 261 ///\e 223 262 void set(Key k, bool v) { imap.set(k,v);} 263 ///Returns the number of \c true values in the map. 264 ///This is a constant time operation. 265 int countTrue() { return imap.countTrue(); } 266 ///Number of \c false items in the map 267 268 ///Returns the number of \c false values in the map. 269 ///This is a constant time operation. 270 int countFalse() { return imap.countFalse(); } 224 271 #ifdef DOXYGEN 225 272 ///\e … … 235 282 { 236 283 public: 284 ///\e 237 285 explicit FalseIt(const IterableBoolEdgeMap &m) 238 286 : BimType::FalseIt(m.imap) { } 287 ///\e 239 288 FalseIt(Invalid i) : BimType::FalseIt(i) { } 240 289 }; … … 243 292 { 244 293 public: 294 ///\e 245 295 explicit TrueIt(const IterableBoolEdgeMap &m) 246 296 : BimType::TrueIt(m.imap) { } 297 ///\e 247 298 TrueIt(Invalid i) : BimType::TrueIt(i) { } 248 299 };
Note: See TracChangeset
for help on using the changeset viewer.