dune-typetree 2.8.0
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
Dune::TypeTree::Experimental Namespace Reference

Namespaces

namespace  Info
 

Classes

struct  DefaultHybridVisitor
 Hybrid visitor interface and base class for TypeTree hybrid visitors. More...
 

Functions

template<typename Tree , typename Visitor , typename Init >
auto hybridApplyToTree (Tree &&tree, Visitor &&visitor, Init &&init)
 Apply hybrid visitor to TypeTree. More...
 

Function Documentation

◆ hybridApplyToTree()

template<typename Tree , typename Visitor , typename Init >
auto Dune::TypeTree::Experimental::hybridApplyToTree ( Tree &&  tree,
Visitor &&  visitor,
Init &&  init 
)

Apply hybrid visitor to TypeTree.

This function applies the given hybrid visitor to the tree in a depth-first traversal and returns the accumulated value. This method is able to accumulate/transform different types on both dynamic and static trees as long as they match on consecutive calls of the visitor. On calls between dynamic childen, the carried type should be consistent. On static children types may differ as long as they are expected on the next visited node.

Note
Tree may be const or non-const
If the carried type is always the same, consider applyToTree which is less demanding on the compiler.
The visitor must implement the interface laid out by DefaultHybridVisitor (most easily achieved by inheriting from it) and specify the required type of tree traversal preference (static or dynamic) by inheriting from either StaticTraversal or DynamicTraversal.
Parameters
treeThe tree the visitor will be applied to.
visitorThe hybrid visitor to apply to the tree.
initInitial value to pass to the visitor
Returns
auto Result of the last call on the visitor