89 void AllTop(std::vector<T*>* topvec) {
91 if (
Size() == 0)
return;
92 std::list<int> need_to_check_children;
93 need_to_check_children.push_back(0);
96 while (!need_to_check_children.empty()) {
97 int ind = need_to_check_children.front();
98 need_to_check_children.pop_front();
99 topvec->push_back(elems_[ind]);
100 int leftchild = 1 + 2 * ind;
101 if (leftchild <
Size()) {
103 need_to_check_children.push_back(leftchild);
105 int rightchild = leftchild + 1;
106 if (rightchild <
Size() &&
108 need_to_check_children.push_back(rightchild);