GUI2/Iterator/Policy Order: updated for 3bc7c6a

This commit is contained in:
Charles Dang 2018-06-23 07:18:52 +11:00
parent 3bc7c6a3a0
commit c3ed9d2bc7

View file

@ -61,13 +61,6 @@ public:
~bottom_up() ~bottom_up()
{ {
delete root_;
for(std::vector<iteration::walker_base*>::iterator itor = stack_.begin();
itor != stack_.end();
++itor) {
delete *itor;
}
} }
bool at_end() const bool at_end() const
@ -134,8 +127,6 @@ public:
TST_GUI_I << " Finished iteration.\n"; TST_GUI_I << " Finished iteration.\n";
return false; return false;
} else { } else {
delete root_;
root_ = stack_.back(); root_ = stack_.back();
stack_.pop_back(); stack_.pop_back();
TST_GUI_I << " Up '" << operator*().id() << "'."; TST_GUI_I << " Up '" << operator*().id() << "'.";
@ -191,9 +182,9 @@ public:
} }
private: private:
iteration::walker_base* root_; iteration::walker_ptr root_;
std::vector<iteration::walker_base*> stack_; std::vector<iteration::walker_ptr> stack_;
}; };
template <bool VW, bool VG, bool VC> template <bool VW, bool VG, bool VC>
@ -212,13 +203,6 @@ public:
~top_down() ~top_down()
{ {
delete root_;
for(std::vector<iteration::walker_base*>::iterator itor = stack_.begin();
itor != stack_.end();
++itor) {
delete *itor;
}
} }
bool at_end() const bool at_end() const
@ -326,8 +310,6 @@ private:
bool up() bool up()
{ {
while(!stack_.empty()) { while(!stack_.empty()) {
delete root_;
root_ = stack_.back(); root_ = stack_.back();
stack_.pop_back(); stack_.pop_back();
TST_GUI_I << " Up widget '" << operator*().id() << "'. Iterate:"; TST_GUI_I << " Up widget '" << operator*().id() << "'. Iterate:";
@ -345,9 +327,9 @@ private:
return true; return true;
} }
iteration::walker_base* root_; iteration::walker_ptr root_;
std::vector<iteration::walker_base*> stack_; std::vector<iteration::walker_ptr> stack_;
}; };
} // namespace order } // namespace order