Layout tree iterator tools
Description
This MR adds tools to facilitate traversal of the layout tree, as described in #42 (closed). Two new syntaxes are introduced:
-
parent.recursive_children()
returns a range that comprises all descendants of a node/ I preferredrecursive_children
to not have functions calledchildren
anddescendants
, which I found confusing. -
range | filter_nodes<type>
(whererange
is eitherchildren()
orrecursive_children()
) returns a new range with only nodes of the giventype
, returned as references rather than pointers. The pipe syntax is taken from theboost::adaptors
library, but I didn't follow its naming convention (would have beenfiltered_nodes
).
Related Issue
Closes #42 (closed).
How Has This Been Tested?
Bundled unit tests.
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
-
My code follows the code style of this project. -
My change requires a change to the documentation. -
I have updated the documentation accordingly. -
I have read the CONTRIBUTING document. -
I have added tests to cover my changes. -
All new and existing tests passed.
Edited by Laurent Petre