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
When i try to use the fixed_depth iteration i am running into issues.
First of all this assertion always blocks my code from running: assert(1==0); // FIXME: not correct yet: use is_valid() as a temporary workaround
Also i have issues when using the begin_fixed() and end_fixed() to define the range of my iteration.
could you maybe provide an example on how to properly iterate over all the nodes at a certain depth and within this iteration create a child for every node?
Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered:
The fixed-depth iterators lack proper STL behaviour in the sense that there is no end-iterator. But you can still iterate over elements at a fixed depth by getting the begin-iterator using auto it = begin_fixed(...) and then iterating until it.is_valid() no longer returns true. So something like
auto it = tr.begin_fixed(tr.begin(), 3);
while(it.is_valid()) {
tr.append_child(it, ...);
++it;
}
auto it = tr.begin_fixed(tr.begin(), 3);
while(it.is_valid()) {
tr.append_child(it, ...);
++it;
}
Sorry to revive an old question, but (unless I'm missing something) it looks like a fixed_depth_iterator doesn't have a is_valid() method; should this be using something like:
auto it = tr.begin_fixed(tr.begin(), 3);
while (tr.is_valid(it)) {
tr.append_child(it, ...);
++it;
}
kpeeters
changed the title
Example to fixed_depth_iterator
Example to fixed_depth_iterator / missing end-iterator for fixed_depth_iterator
Jul 19, 2024
When i try to use the fixed_depth iteration i am running into issues.
First of all this assertion always blocks my code from running:
assert(1==0); // FIXME: not correct yet: use is_valid() as a temporary workaround
Also i have issues when using the begin_fixed() and end_fixed() to define the range of my iteration.
could you maybe provide an example on how to properly iterate over all the nodes at a certain depth and within this iteration create a child for every node?
Any help is greatly appreciated!
The text was updated successfully, but these errors were encountered: