- Timestamp:
- Nov 20, 2007, 8:47:13 PM (17 years ago)
- Location:
- code/branches/objecthierarchie/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchie/src/Iterator.h
r224 r225 28 28 } 29 29 30 Iterator<T> operator++() 31 { 32 this->elementForwards_ = this->elementForwards_->next_; 33 return *this; 34 } 35 30 36 Iterator<T> operator--(int step) 31 37 { … … 44 50 this->elementBackwards_ = this->elementBackwards_->prev_; 45 51 } 52 } 46 53 47 return copy; 54 Iterator<T> operator--() 55 { 56 if (this->iteratingForwards_) 57 this->iteratingForwards_ = false; 58 else 59 this->elementBackwards_ = this->elementBackwards_->prev_; 60 61 return *this; 48 62 } 49 63 … … 51 65 { 52 66 if (this->iteratingForwards_) 53 return /*dynamic_cast<T*>*/(this->elementForwards_->object_);67 return this->elementForwards_->object_; 54 68 else 55 return /*dynamic_cast<T*>*/(this->elementBackwards_->object_);69 return this->elementBackwards_->object_; 56 70 } 57 71 … … 59 73 { 60 74 if (this->iteratingForwards_) 61 return /*dynamic_cast<T*>*/(this->elementForwards_->object_);75 return this->elementForwards_->object_; 62 76 else 63 return /*dynamic_cast<T*>*/(this->elementBackwards_->object_);77 return this->elementBackwards_->object_; 64 78 65 79 } -
code/branches/objecthierarchie/src/orxonox.cc
r224 r225 543 543 std::cout << "1\n"; 544 544 int count = 0; 545 for (Iterator<BaseObject> it; it != 0; it++)545 for (Iterator<BaseObject> it; it != 0; ++it) 546 546 count++; 547 547 std::cout << "Anzahl BaseObjects: " << count << "\n"; 548 548 549 549 count = 0; 550 for (Iterator<A1> it; it != 0; it++)550 for (Iterator<A1> it; it != 0; ++it) 551 551 count++; 552 552 std::cout << "Anzahl A1: " << count << "\n"; 553 553 554 554 count = 0; 555 for (Iterator<A1B1> it; it; it++)555 for (Iterator<A1B1> it; it; ++it) 556 556 count++; 557 557 std::cout << "Anzahl A1B1: " << count << "\n"; 558 558 559 559 count = 0; 560 for (Iterator<A1B1C1> it; it; it++)560 for (Iterator<A1B1C1> it; it; ++it) 561 561 count++; 562 562 std::cout << "Anzahl A1B1C1: " << count << "\n"; 563 563 564 564 count = 0; 565 for (Iterator<A2> it; it; it++)565 for (Iterator<A2> it; it; ++it) 566 566 count++; 567 567 std::cout << "Anzahl A2: " << count << "\n"; … … 585 585 } 586 586 587 for (Iterator<A2B1C1> it; it; it++)587 for (Iterator<A2B1C1> it; it; ++it) 588 588 std::cout << "Name: " << it->name_ << "\n"; 589 589 590 590 std::cout << "3\n"; 591 for (Iterator<A2B1C1> it; it; it--)591 for (Iterator<A2B1C1> it; it; --it) 592 592 std::cout << "Name: " << it->name_ << "\n"; 593 593 … … 596 596 597 597 std::cout << "5\n"; 598 for (Iterator<A2B1C1> it; it; it++)598 for (Iterator<A2B1C1> it; it; ++it) 599 599 std::cout << "Name: " << it->name_ << "\n"; 600 600 601 601 std::cout << "6\n"; 602 for (Iterator<A2B1C1> it; it; it--)602 for (Iterator<A2B1C1> it; it; --it) 603 603 std::cout << "Name: " << it->name_ << "\n"; 604 604 … … 607 607 608 608 std::cout << "8\n"; 609 for (Iterator<A2B1C1> it; it; it++)609 for (Iterator<A2B1C1> it; it; ++it) 610 610 std::cout << "Name: " << it->name_ << "\n"; 611 611 612 612 std::cout << "9\n"; 613 for (Iterator<A2B1C1> it; it; it--)613 for (Iterator<A2B1C1> it; it; --it) 614 614 std::cout << "Name: " << it->name_ << "\n"; 615 615 … … 618 618 619 619 std::cout << "11\n"; 620 for (Iterator<A2B1C1> it; it; it++)620 for (Iterator<A2B1C1> it; it; ++it) 621 621 std::cout << "Name: " << it->name_ << "\n"; 622 622 623 623 std::cout << "12\n"; 624 for (Iterator<A2B1C1> it; it; it--)624 for (Iterator<A2B1C1> it; it; --it) 625 625 std::cout << "Name: " << it->name_ << "\n"; 626 626
Note: See TracChangeset
for help on using the changeset viewer.