Loading...
Searching...
No Matches
Traversal
TypeTree
Collaboration diagram for Traversal:

## Functions

template<Concept::InnerTreeNode Tree, class Callable>
constexpr void | Dune::TypeTree::forEachChild (Tree &&container, Callable &&at_value)
| Traverse each child of a tree and apply a callable function.
template<class Tree, class PreNodeFunc, class LeafNodeFunc, class PostNodeFunc>
void | Dune::TypeTree::forEachNode (Tree &&tree, PreNodeFunc &&preNodeFunc, LeafNodeFunc &&leafNodeFunc, PostNodeFunc &&postNodeFunc)
| Traverse tree and visit each node.
template<Concept::TreeNode Tree, class NodeFunc>
void | Dune::TypeTree::forEachNode (Tree &&tree, NodeFunc &&nodeFunc)
| Traverse tree and visit each node.
template<Concept::TreeNode Tree, class LeafFunc>
void | Dune::TypeTree::forEachLeafNode (Tree &&tree, LeafFunc &&leafFunc)
| Traverse tree and visit each leaf node.

## Detailed Description

## Function Documentation

## forEachChild()

template<Concept::InnerTreeNode Tree, class Callable>

void Dune::TypeTree::forEachChild | ( | Tree && | container,
|  | Callable && | at_value )

constexpr

Traverse each child of a tree and apply a callable function.

This function iterates over each child node of a given tree and applies a callable function to each child. The callable function can accept either one or two arguments: the child node itself, and optionally, its index.

Template Parameters

  Tree | The type of the tree container to be traversed. This must satisfy the Concept::InnerTreeNode concept.
  Callable | The type of the callable function (functor) to be applied to each child node. This can be a lambda, function pointer, or any callable object.

Parameters

  container | The tree container whose children will be traversed.
  at_value | The callable function to be applied to each child node. This function can accept either one argument (the child node) or two arguments (the child node and its index).

## forEachLeafNode()

template<Concept::TreeNode Tree, class LeafFunc>

void Dune::TypeTree::forEachLeafNode | ( | Tree && | tree,
|  | LeafFunc && | leafFunc )

Traverse tree and visit each leaf node.

The passed callback function is called with the node and corresponding treepath as arguments.

Parameters

  tree | The tree to traverse
  leafFunc | This function is called for each leaf node

## forEachNode() [1/2]

template<Concept::TreeNode Tree, class NodeFunc>

void Dune::TypeTree::forEachNode | ( | Tree && | tree,
|  | NodeFunc && | nodeFunc )

Traverse tree and visit each node.

The passed callback function is called with the node and corresponding treepath as arguments.

Parameters

  tree | The tree to traverse
  nodeFunc | This function is called for each node

## forEachNode() [2/2]

template<class Tree, class PreNodeFunc, class LeafNodeFunc, class PostNodeFunc>

void Dune::TypeTree::forEachNode | ( | Tree && | tree,
|  | PreNodeFunc && | preNodeFunc,
|  | LeafNodeFunc && | leafNodeFunc,
|  | PostNodeFunc && | postNodeFunc )

Traverse tree and visit each node.

This does an in-order traversal of the tree. For leaf node the leafNodeFunc callback is called. For each inner node this function first calls the preNodeFunc, then it traverses the children, and then it calls the postNodeFunc. All callback functions are called with the node and corresponding treepath as arguments.

Parameters

  tree | The tree to traverse
  preNodeFunc | This function is called for each inner node
  leafNodeFunc | This function is called for each leaf node
  postNodeFunc | This function is called for each inner node