You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tree<int> tr;
auto top = tr.begin();
auto root = tr.insert(top, 0);
auto a1 = tr.append_child(root, 1);
auto a2 = tr.append_child(root, 2);
auto a3 = tr.append_child(root, 3);
tr.append_child(a1, 11);
tr.append_child(a1, 12);
tr.append_child(a1, 13);
tr.append_child(a2, 21);
tr.append_child(a2, 22);
tr.append_child(a2, 23);
tr.append_child(a3, 31);
tr.append_child(a3, 32);
tr.append_child(a3, 33);
auto iter = tr.begin_breadth_first();
auto end = tr.end_breadth_first();
while (end != iter)
{
if (*iter == 2) // erase '2'
{
iter = tr.erase(iter);
}
else
{
cout << *iter << endl;
++iter; // The node '2' is still being traversed, but it has already been deleted.
}
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: