Changeset 2386:81b47fc5c444 in lemon-0.x for lemon/bits
- Timestamp:
- 03/02/07 19:04:28 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3217
- Location:
- lemon/bits
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/bits/alteration_notifier.h
r2384 r2386 149 149 /// 150 150 /// Constructor which attach the observer into notifier. 151 ObserverBase(AlterationNotifier& n otifier) {152 attach(n otifier);151 ObserverBase(AlterationNotifier& nf) { 152 attach(nf); 153 153 } 154 154 … … 159 159 ObserverBase(const ObserverBase& copy) { 160 160 if (copy.attached()) { 161 attach(*copy. _notifier());161 attach(*copy.notifier()); 162 162 } 163 163 } … … 174 174 /// This member attaches the observer into an AlterationNotifier. 175 175 /// 176 void attach(AlterationNotifier& n otifier) {177 n otifier.attach(*this);176 void attach(AlterationNotifier& nf) { 177 nf.attach(*this); 178 178 } 179 179 -
lemon/bits/array_map.h
r2384 r2386 82 82 Parent::attach(graph.notifier(Item())); 83 83 allocate_memory(); 84 Notifier* n otifier= Parent::notifier();85 Item it; 86 for (n otifier->first(it); it != INVALID; notifier->next(it)) {87 int id = n otifier->id(it);;84 Notifier* nf = Parent::notifier(); 85 Item it; 86 for (nf->first(it); it != INVALID; nf->next(it)) { 87 int id = nf->id(it);; 88 88 allocator.construct(&(values[id]), Value()); 89 89 } … … 96 96 Parent::attach(graph.notifier(Item())); 97 97 allocate_memory(); 98 Notifier* n otifier= Parent::notifier();99 Item it; 100 for (n otifier->first(it); it != INVALID; notifier->next(it)) {101 int id = n otifier->id(it);;98 Notifier* nf = Parent::notifier(); 99 Item it; 100 for (nf->first(it); it != INVALID; nf->next(it)) { 101 int id = nf->id(it);; 102 102 allocator.construct(&(values[id]), value); 103 103 } … … 114 114 if (capacity == 0) return; 115 115 values = allocator.allocate(capacity); 116 Notifier* n otifier= Parent::notifier();117 Item it; 118 for (n otifier->first(it); it != INVALID; notifier->next(it)) {119 int id = n otifier->id(it);;116 Notifier* nf = Parent::notifier(); 117 Item it; 118 for (nf->first(it); it != INVALID; nf->next(it)) { 119 int id = nf->id(it);; 120 120 allocator.construct(&(values[id]), copy.values[id]); 121 121 } … … 143 143 ArrayMap& operator=(const CMap& cmap) { 144 144 checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); 145 const typename Parent::Notifier* n otifier= Parent::notifier();146 Item it; 147 for (n otifier->first(it); it != INVALID; notifier->next(it)) {145 const typename Parent::Notifier* nf = Parent::notifier(); 146 Item it; 147 for (nf->first(it); it != INVALID; nf->next(it)) { 148 148 set(it, cmap[it]); 149 149 } … … 202 202 /// and it overrides the add() member function of the observer base. 203 203 virtual void add(const Key& key) { 204 Notifier* n otifier= Parent::notifier();205 int id = n otifier->id(key);204 Notifier* nf = Parent::notifier(); 205 int id = nf->id(key); 206 206 if (id >= capacity) { 207 207 int new_capacity = (capacity == 0 ? 1 : capacity); … … 211 211 Value* new_values = allocator.allocate(new_capacity); 212 212 Item it; 213 for (n otifier->first(it); it != INVALID; notifier->next(it)) {214 int jd = n otifier->id(it);;213 for (nf->first(it); it != INVALID; nf->next(it)) { 214 int jd = nf->id(it);; 215 215 if (id != jd) { 216 216 allocator.construct(&(new_values[jd]), values[jd]); … … 230 230 /// and it overrides the add() member function of the observer base. 231 231 virtual void add(const std::vector<Key>& keys) { 232 Notifier* n otifier= Parent::notifier();232 Notifier* nf = Parent::notifier(); 233 233 int max_id = -1; 234 for (int i = 0; i < (int)keys.size(); ++i) {235 int id = n otifier->id(keys[i]);234 for (int i = 0; i < int(keys.size()); ++i) { 235 int id = nf->id(keys[i]); 236 236 if (id > max_id) { 237 237 max_id = id; … … 245 245 Value* new_values = allocator.allocate(new_capacity); 246 246 Item it; 247 for (n otifier->first(it); it != INVALID; notifier->next(it)) {248 int id = n otifier->id(it);247 for (nf->first(it); it != INVALID; nf->next(it)) { 248 int id = nf->id(it); 249 249 bool found = false; 250 for (int i = 0; i < (int)keys.size(); ++i) {251 int jd = n otifier->id(keys[i]);250 for (int i = 0; i < int(keys.size()); ++i) { 251 int jd = nf->id(keys[i]); 252 252 if (id == jd) { 253 253 found = true; … … 263 263 capacity = new_capacity; 264 264 } 265 for (int i = 0; i < (int)keys.size(); ++i) {266 int id = n otifier->id(keys[i]);265 for (int i = 0; i < int(keys.size()); ++i) { 266 int id = nf->id(keys[i]); 267 267 allocator.construct(&(values[id]), Value()); 268 268 } … … 283 283 /// and it overrides the erase() member function of the observer base. 284 284 virtual void erase(const std::vector<Key>& keys) { 285 for (int i = 0; i < (int)keys.size(); ++i) {285 for (int i = 0; i < int(keys.size()); ++i) { 286 286 int id = Parent::notifier()->id(keys[i]); 287 287 allocator.destroy(&(values[id])); … … 294 294 /// and it overrides the build() member function of the observer base. 295 295 virtual void build() { 296 Notifier* n otifier= Parent::notifier();296 Notifier* nf = Parent::notifier(); 297 297 allocate_memory(); 298 298 Item it; 299 for (n otifier->first(it); it != INVALID; notifier->next(it)) {300 int id = n otifier->id(it);;299 for (nf->first(it); it != INVALID; nf->next(it)) { 300 int id = nf->id(it);; 301 301 allocator.construct(&(values[id]), Value()); 302 302 } … … 308 308 /// and it overrides the clear() member function of the observer base. 309 309 virtual void clear() { 310 Notifier* n otifier= Parent::notifier();310 Notifier* nf = Parent::notifier(); 311 311 if (capacity != 0) { 312 312 Item it; 313 for (n otifier->first(it); it != INVALID; notifier->next(it)) {314 int id = n otifier->id(it);313 for (nf->first(it); it != INVALID; nf->next(it)) { 314 int id = nf->id(it); 315 315 allocator.destroy(&(values[id])); 316 316 } -
lemon/bits/base_extender.h
r2260 r2386 194 194 } 195 195 196 Node nodeFromId(int i d) const {197 return Parent::nodeFromId(i d);198 } 199 200 Edge edgeFromId(int i d) const {201 return direct(Parent::edgeFromId(i d >> 1), bool(id& 1));202 } 203 204 UEdge uEdgeFromId(int i d) const {205 return Parent::edgeFromId(i d);196 Node nodeFromId(int ix) const { 197 return Parent::nodeFromId(ix); 198 } 199 200 Edge edgeFromId(int ix) const { 201 return direct(Parent::edgeFromId(ix >> 1), bool(ix & 1)); 202 } 203 204 UEdge uEdgeFromId(int ix) const { 205 return Parent::edgeFromId(ix); 206 206 } 207 207 … … 239 239 } 240 240 241 Edge findEdge(Node s ource, Node target, Edge prev= INVALID) const {242 if (p rev== INVALID) {243 UEdge edge = Parent::findEdge(s ource, target);241 Edge findEdge(Node s, Node t, Edge p = INVALID) const { 242 if (p == INVALID) { 243 UEdge edge = Parent::findEdge(s, t); 244 244 if (edge != INVALID) return direct(edge, true); 245 edge = Parent::findEdge(t arget, source);245 edge = Parent::findEdge(t, s); 246 246 if (edge != INVALID) return direct(edge, false); 247 } else if (direction(p rev)) {248 UEdge edge = Parent::findEdge(s ource, target, prev);247 } else if (direction(p)) { 248 UEdge edge = Parent::findEdge(s, t, p); 249 249 if (edge != INVALID) return direct(edge, true); 250 edge = Parent::findEdge(t arget, source);250 edge = Parent::findEdge(t, s); 251 251 if (edge != INVALID) return direct(edge, false); 252 252 } else { 253 UEdge edge = Parent::findEdge(t arget, source, prev);253 UEdge edge = Parent::findEdge(t, s, p); 254 254 if (edge != INVALID) return direct(edge, false); 255 255 } … … 257 257 } 258 258 259 UEdge findUEdge(Node s ource, Node target, UEdge prev= INVALID) const {260 if (s ource != target) {261 if (p rev== INVALID) {262 UEdge edge = Parent::findEdge(s ource, target);259 UEdge findUEdge(Node s, Node t, UEdge p = INVALID) const { 260 if (s != t) { 261 if (p == INVALID) { 262 UEdge edge = Parent::findEdge(s, t); 263 263 if (edge != INVALID) return edge; 264 edge = Parent::findEdge(t arget, source);264 edge = Parent::findEdge(t, s); 265 265 if (edge != INVALID) return edge; 266 } else if (Parent::s ource(prev) == source) {267 UEdge edge = Parent::findEdge(s ource, target, prev);266 } else if (Parent::s(p) == s) { 267 UEdge edge = Parent::findEdge(s, t, p); 268 268 if (edge != INVALID) return edge; 269 edge = Parent::findEdge(t arget, source);269 edge = Parent::findEdge(t, s); 270 270 if (edge != INVALID) return edge; 271 271 } else { 272 UEdge edge = Parent::findEdge(t arget, source, prev);272 UEdge edge = Parent::findEdge(t, s, p); 273 273 if (edge != INVALID) return edge; 274 274 } 275 275 } else { 276 return Parent::findEdge(s ource, target, prev);276 return Parent::findEdge(s, t, p); 277 277 } 278 278 return INVALID; … … 358 358 } 359 359 360 void firstInc(UEdge& edge, bool& dir ection, const Node& node) const {360 void firstInc(UEdge& edge, bool& dir, const Node& node) const { 361 361 if (Parent::aNode(node)) { 362 362 Parent::firstFromANode(edge, node); 363 dir ection= true;363 dir = true; 364 364 } else { 365 365 Parent::firstFromBNode(edge, node); 366 dir ection= static_cast<UEdge&>(edge) == INVALID;367 } 368 } 369 void nextInc(UEdge& edge, bool& dir ection) const {370 if (dir ection) {366 dir = static_cast<UEdge&>(edge) == INVALID; 367 } 368 } 369 void nextInc(UEdge& edge, bool& dir) const { 370 if (dir) { 371 371 Parent::nextFromANode(edge); 372 372 } else { 373 373 Parent::nextFromBNode(edge); 374 if (edge == INVALID) dir ection= true;374 if (edge == INVALID) dir = true; 375 375 } 376 376 } … … 458 458 (edge.forward ? 0 : 1); 459 459 } 460 Edge edgeFromId(int i d) const {461 return Edge(Parent::fromUEdgeId(i d >> 1), (id& 1) == 0);460 Edge edgeFromId(int ix) const { 461 return Edge(Parent::fromUEdgeId(ix >> 1), (ix & 1) == 0); 462 462 } 463 463 int maxEdgeId() const { … … 469 469 } 470 470 471 Edge direct(const UEdge& edge, bool dir ection) const {472 return Edge(edge, dir ection);471 Edge direct(const UEdge& edge, bool dir) const { 472 return Edge(edge, dir); 473 473 } 474 474 -
lemon/bits/debug_map.h
r2384 r2386 166 166 } 167 167 } 168 for (int i = 0; i < (int)flag.size(); ++i) {168 for (int i = 0; i < int(flag.size()); ++i) { 169 169 LEMON_ASSERT(!flag[i], MapError()); 170 170 } … … 236 236 virtual void add(const Key& key) { 237 237 int id = Parent::notifier()->id(key); 238 if (id >= (int)container.size()) {238 if (id >= int(container.size())) { 239 239 container.resize(id + 1); 240 240 flag.resize(id + 1, false); … … 247 247 Item it; 248 248 for (notifier->first(it); it != INVALID; notifier->next(it)) { 249 int id = Parent::notifier()->id(it);250 fl[ id] = true;249 int jd = Parent::notifier()->id(it); 250 fl[jd] = true; 251 251 } 252 252 LEMON_ASSERT(fl == flag, MapError()); … … 260 260 virtual void add(const std::vector<Key>& keys) { 261 261 int max = container.size() - 1; 262 for (int i = 0; i < (int)keys.size(); ++i) {262 for (int i = 0; i < int(keys.size()); ++i) { 263 263 int id = Parent::notifier()->id(keys[i]); 264 264 if (id >= max) { … … 268 268 container.resize(max + 1); 269 269 flag.resize(max + 1, false); 270 for (int i = 0; i < (int)keys.size(); ++i) {270 for (int i = 0; i < int(keys.size()); ++i) { 271 271 LEMON_ASSERT(!flag[Parent::notifier()->id(keys[i])], MapError()); 272 272 flag[Parent::notifier()->id(keys[i])] = true; … … 319 319 LEMON_ASSERT(fl == flag, MapError()); 320 320 } 321 for (int i = 0; i < (int)keys.size(); ++i) {321 for (int i = 0; i < int(keys.size()); ++i) { 322 322 container[Parent::notifier()->id(keys[i])] = Value(); 323 323 LEMON_ASSERT(flag[Parent::notifier()->id(keys[i])], MapError()); … … 332 332 virtual void build() { 333 333 if (strictCheck) { 334 for (int i = 0; i < (int)flag.size(); ++i) {334 for (int i = 0; i < int(flag.size()); ++i) { 335 335 LEMON_ASSERT(flag[i], MapError()); 336 336 } … … 363 363 } 364 364 if (strictCheck) { 365 for (int i = 0; i < (int)flag.size(); ++i) {365 for (int i = 0; i < int(flag.size()); ++i) { 366 366 LEMON_ASSERT(!flag[i], MapError()); 367 367 } -
lemon/bits/edge_set_extender.h
r2384 r2386 190 190 /// Returns the base node (ie. the source in this case) of the iterator 191 191 Node baseNode(const OutEdgeIt &e) const { 192 return Parent::source( (Edge)e);192 return Parent::source(static_cast<const Edge&>(e)); 193 193 } 194 194 /// \brief Running node of the iterator … … 197 197 /// iterator 198 198 Node runningNode(const OutEdgeIt &e) const { 199 return Parent::target( (Edge)e);199 return Parent::target(static_cast<const Edge&>(e)); 200 200 } 201 201 … … 204 204 /// Returns the base node (ie. the target in this case) of the iterator 205 205 Node baseNode(const InEdgeIt &e) const { 206 return Parent::target( (Edge)e);206 return Parent::target(static_cast<const Edge&>(e)); 207 207 } 208 208 /// \brief Running node of the iterator … … 211 211 /// iterator 212 212 Node runningNode(const InEdgeIt &e) const { 213 return Parent::source( (Edge)e);213 return Parent::source(static_cast<const Edge&>(e)); 214 214 } 215 215 … … 497 497 /// Returns the base node (ie. the source in this case) of the iterator 498 498 Node baseNode(const OutEdgeIt &e) const { 499 return Parent::source( (Edge)e);499 return Parent::source(static_cast<const Edge&>(e)); 500 500 } 501 501 /// \brief Running node of the iterator … … 504 504 /// iterator 505 505 Node runningNode(const OutEdgeIt &e) const { 506 return Parent::target( (Edge)e);506 return Parent::target(static_cast<const Edge&>(e)); 507 507 } 508 508 … … 511 511 /// Returns the base node (ie. the target in this case) of the iterator 512 512 Node baseNode(const InEdgeIt &e) const { 513 return Parent::target( (Edge)e);513 return Parent::target(static_cast<const Edge&>(e)); 514 514 } 515 515 /// \brief Running node of the iterator … … 518 518 /// iterator 519 519 Node runningNode(const InEdgeIt &e) const { 520 return Parent::source( (Edge)e);520 return Parent::source(static_cast<const Edge&>(e)); 521 521 } 522 522 -
lemon/bits/graph_adaptor_extender.h
r2231 r2386 400 400 /// Returns the base node (ie. the source in this case) of the iterator 401 401 Node baseNode(const OutEdgeIt &e) const { 402 return Parent::source( (Edge)e);402 return Parent::source(static_cast<const Edge&>(e)); 403 403 } 404 404 /// \brief Running node of the iterator … … 407 407 /// iterator 408 408 Node runningNode(const OutEdgeIt &e) const { 409 return Parent::target( (Edge)e);409 return Parent::target(static_cast<const Edge&>(e)); 410 410 } 411 411 … … 414 414 /// Returns the base node (ie. the target in this case) of the iterator 415 415 Node baseNode(const InEdgeIt &e) const { 416 return Parent::target( (Edge)e);416 return Parent::target(static_cast<const Edge&>(e)); 417 417 } 418 418 /// \brief Running node of the iterator … … 421 421 /// iterator 422 422 Node runningNode(const InEdgeIt &e) const { 423 return Parent::source( (Edge)e);423 return Parent::source(static_cast<const Edge&>(e)); 424 424 } 425 425 … … 652 652 /// Returns the base node (ie. the source in this case) of the iterator 653 653 Node baseNode(const OutEdgeIt &e) const { 654 return Parent::source( (Edge&)e);654 return Parent::source(static_cast<const Edge&>(e)); 655 655 } 656 656 /// \brief Running node of the iterator … … 659 659 /// iterator 660 660 Node runningNode(const OutEdgeIt &e) const { 661 return Parent::target( (Edge&)e);661 return Parent::target(static_cast<const Edge&>(e)); 662 662 } 663 663 … … 666 666 /// Returns the base node (ie. the target in this case) of the iterator 667 667 Node baseNode(const InEdgeIt &e) const { 668 return Parent::target( (Edge&)e);668 return Parent::target(static_cast<const Edge&>(e)); 669 669 } 670 670 /// \brief Running node of the iterator … … 673 673 /// iterator 674 674 Node runningNode(const InEdgeIt &e) const { 675 return Parent::source( (Edge&)e);675 return Parent::source(static_cast<const Edge&>(e)); 676 676 } 677 677 -
lemon/bits/graph_extender.h
r2384 r2386 557 557 /// Returns the base node (ie. the source in this case) of the iterator 558 558 Node baseNode(const OutEdgeIt &e) const { 559 return Parent::source( (Edge)e);559 return Parent::source(static_cast<const Edge&>(e)); 560 560 } 561 561 /// \brief Running node of the iterator … … 564 564 /// iterator 565 565 Node runningNode(const OutEdgeIt &e) const { 566 return Parent::target( (Edge)e);566 return Parent::target(static_cast<const Edge&>(e)); 567 567 } 568 568 … … 571 571 /// Returns the base node (ie. the target in this case) of the iterator 572 572 Node baseNode(const InEdgeIt &e) const { 573 return Parent::target( (Edge)e);573 return Parent::target(static_cast<const Edge&>(e)); 574 574 } 575 575 /// \brief Running node of the iterator … … 578 578 /// iterator 579 579 Node runningNode(const InEdgeIt &e) const { 580 return Parent::source( (Edge)e);580 return Parent::source(static_cast<const Edge&>(e)); 581 581 } 582 582 … … 680 680 UEdge uedge = Parent::addEdge(from, to); 681 681 notifier(UEdge()).add(uedge); 682 std::vector<Edge> e dges;683 e dges.push_back(Parent::direct(uedge, true));684 e dges.push_back(Parent::direct(uedge, false));685 notifier(Edge()).add(e dges);682 std::vector<Edge> ev; 683 ev.push_back(Parent::direct(uedge, true)); 684 ev.push_back(Parent::direct(uedge, false)); 685 notifier(Edge()).add(ev); 686 686 return uedge; 687 687 } … … 722 722 723 723 void erase(const UEdge& uedge) { 724 std::vector<Edge> e dges;725 e dges.push_back(Parent::direct(uedge, true));726 e dges.push_back(Parent::direct(uedge, false));727 notifier(Edge()).erase(e dges);724 std::vector<Edge> ev; 725 ev.push_back(Parent::direct(uedge, true)); 726 ev.push_back(Parent::direct(uedge, false)); 727 notifier(Edge()).erase(ev); 728 728 notifier(UEdge()).erase(uedge); 729 729 Parent::erase(uedge); … … 1008 1008 /// Returns the base node (ie. the source in this case) of the iterator 1009 1009 Node baseNode(const OutEdgeIt &e) const { 1010 return Parent::source( (Edge&)e);1010 return Parent::source(static_cast<const Edge&>(e)); 1011 1011 } 1012 1012 /// \brief Running node of the iterator … … 1015 1015 /// iterator 1016 1016 Node runningNode(const OutEdgeIt &e) const { 1017 return Parent::target( (Edge&)e);1017 return Parent::target(static_cast<const Edge&>(e)); 1018 1018 } 1019 1019 … … 1022 1022 /// Returns the base node (ie. the target in this case) of the iterator 1023 1023 Node baseNode(const InEdgeIt &e) const { 1024 return Parent::target( (Edge&)e);1024 return Parent::target(static_cast<const Edge&>(e)); 1025 1025 } 1026 1026 /// \brief Running node of the iterator … … 1029 1029 /// iterator 1030 1030 Node runningNode(const InEdgeIt &e) const { 1031 return Parent::source( (Edge&)e);1031 return Parent::source(static_cast<const Edge&>(e)); 1032 1032 } 1033 1033 … … 1296 1296 } 1297 1297 1298 UEdge addEdge(const Node& s ource, const Node& target) {1299 UEdge uedge = Parent::addEdge(s ource, target);1298 UEdge addEdge(const Node& s, const Node& t) { 1299 UEdge uedge = Parent::addEdge(s, t); 1300 1300 notifier(UEdge()).add(uedge); 1301 1301 1302 std::vector<Edge> e dges;1303 e dges.push_back(Parent::direct(uedge, true));1304 e dges.push_back(Parent::direct(uedge, false));1305 notifier(Edge()).add(e dges);1302 std::vector<Edge> ev; 1303 ev.push_back(Parent::direct(uedge, true)); 1304 ev.push_back(Parent::direct(uedge, false)); 1305 notifier(Edge()).add(ev); 1306 1306 1307 1307 return uedge; … … 1352 1352 1353 1353 void erase(const UEdge& uedge) { 1354 std::vector<Edge> e dges;1355 e dges.push_back(Parent::direct(uedge, true));1356 e dges.push_back(Parent::direct(uedge, false));1357 notifier(Edge()).erase(e dges);1354 std::vector<Edge> ev; 1355 ev.push_back(Parent::direct(uedge, true)); 1356 ev.push_back(Parent::direct(uedge, false)); 1357 notifier(Edge()).erase(ev); 1358 1358 notifier(UEdge()).erase(uedge); 1359 1359 Parent::erase(uedge); -
lemon/bits/item_reader.h
r2254 r2386 595 595 if (!(is >> temp)) 596 596 throw DataFormatError("DefaultReader<char> format error"); 597 value = (char)temp;597 value = static_cast<char>(temp); 598 598 break; 599 599 } -
lemon/bits/item_writer.h
r2255 r2386 156 156 if (escaped) { 157 157 std::ostringstream ls; 158 for (int i = 0; i < (int)value.size(); ++i) {158 for (int i = 0; i < int(value.size()); ++i) { 159 159 writeEscape(ls, value[i]); 160 160 } … … 205 205 default: 206 206 if (c < 0x20) { 207 os << '\\' << std::oct << (int)c;207 os << '\\' << std::oct << static_cast<int>(c); 208 208 } else { 209 209 os << c; -
lemon/bits/lp_id.h
r2363 r2386 78 78 impl.index[xn] = impl.first_free; 79 79 impl.first_free = xn; 80 for(int i = fn + 1; i < (int)impl.cross.size(); ++i) {80 for(int i = fn + 1; i < int(impl.cross.size()); ++i) { 81 81 impl.cross[i - 1] = impl.cross[i]; 82 82 impl.index[impl.cross[i]]--; … … 90 90 void firstFloating(int& fn) const { 91 91 fn = impl.first_index; 92 if (fn == (int)impl.cross.size()) fn = -1;92 if (fn == int(impl.cross.size())) fn = -1; 93 93 } 94 94 95 95 void nextFloating(int& fn) const { 96 96 ++fn; 97 if (fn == (int)impl.cross.size()) fn = -1;97 if (fn == int(impl.cross.size())) fn = -1; 98 98 } 99 99 -
lemon/bits/utility.h
r2177 r2386 70 70 71 71 72 class InvalidType { 73 private: 74 InvalidType(); 72 struct InvalidType { 75 73 }; 76 74 -
lemon/bits/variant.h
r2292 r2386 74 74 /// This constructor initalizes to the given value of the \c First 75 75 /// type. 76 BiVariant(const First& f irst) {76 BiVariant(const First& f) { 77 77 flag = true; 78 new(reinterpret_cast<First*>(data)) First(f irst);78 new(reinterpret_cast<First*>(data)) First(f); 79 79 } 80 80 … … 83 83 /// This constructor initalizes to the given value of the \c 84 84 /// Second type. 85 BiVariant(const Second& s econd) {85 BiVariant(const Second& s) { 86 86 flag = false; 87 new(reinterpret_cast<Second*>(data)) Second(s econd);87 new(reinterpret_cast<Second*>(data)) Second(s); 88 88 } 89 89 … … 122 122 /// This function sets the variant to the given value of the \c 123 123 /// First type. 124 BiVariant& setFirst(const First& f irst) {124 BiVariant& setFirst(const First& f) { 125 125 destroy(); 126 126 flag = true; 127 new(reinterpret_cast<First*>(data)) First(f irst);127 new(reinterpret_cast<First*>(data)) First(f); 128 128 return *this; 129 129 } … … 144 144 /// This function sets the variant to the given value of the \c 145 145 /// Second type. 146 BiVariant& setSecond(const Second& s econd) {146 BiVariant& setSecond(const Second& s) { 147 147 destroy(); 148 148 flag = false; 149 new(reinterpret_cast<Second*>(data)) Second(s econd);149 new(reinterpret_cast<Second*>(data)) Second(s); 150 150 return *this; 151 151 } 152 152 153 153 /// \brief Operator form of the \c setFirst() 154 BiVariant& operator=(const First& f irst) {155 return setFirst(f irst);154 BiVariant& operator=(const First& f) { 155 return setFirst(f); 156 156 } 157 157 158 158 /// \brief Operator form of the \c setSecond() 159 BiVariant& operator=(const Second& s econd) {160 return setSecond(s econd);159 BiVariant& operator=(const Second& s) { 160 return setSecond(s); 161 161 } 162 162 -
lemon/bits/vector_map.h
r2384 r2386 135 135 VectorMap& operator=(const CMap& cmap) { 136 136 checkConcept<concepts::ReadMap<Key, _Value>, CMap>(); 137 const typename Parent::Notifier* n otifier= Parent::notifier();137 const typename Parent::Notifier* nf = Parent::notifier(); 138 138 Item it; 139 for (n otifier->first(it); it != INVALID; notifier->next(it)) {139 for (nf->first(it); it != INVALID; nf->next(it)) { 140 140 set(it, cmap[it]); 141 141 } … … 177 177 virtual void add(const Key& key) { 178 178 int id = Parent::notifier()->id(key); 179 if (id >= (int)container.size()) {179 if (id >= int(container.size())) { 180 180 container.resize(id + 1); 181 181 } … … 188 188 virtual void add(const std::vector<Key>& keys) { 189 189 int max = container.size() - 1; 190 for (int i = 0; i < (int)keys.size(); ++i) {190 for (int i = 0; i < int(keys.size()); ++i) { 191 191 int id = Parent::notifier()->id(keys[i]); 192 192 if (id >= max) { … … 210 210 /// and it overrides the erase() member function of the observer base. 211 211 virtual void erase(const std::vector<Key>& keys) { 212 for (int i = 0; i < (int)keys.size(); ++i) {212 for (int i = 0; i < int(keys.size()); ++i) { 213 213 container[Parent::notifier()->id(keys[i])] = Value(); 214 214 }
Note: See TracChangeset
for help on using the changeset viewer.