dune-typetree 2.8.0
Public Types | Static Public Attributes | List of all members
Dune::TypeTree::AccumulateValue< Tree, Functor, Reduction, startValue, ParentChildReduction > Struct Template Reference

Statically accumulate a value over the nodes of a TypeTree. More...

#include <dune/typetree/accumulate_static.hh>

Public Types

typedef Functor::result_type result_type
 The result type of the computation. More...
 

Static Public Attributes

static const result_type result = accumulate_value<Tree,Functor,Reduction,ParentChildReduction,startValue,HybridTreePath<>,NodeTag<Tree>>::result
 The accumulated result of the computation. More...
 

Detailed Description

template<typename Tree, typename Functor, typename Reduction, typename Functor::result_type startValue, typename ParentChildReduction = Reduction>
struct Dune::TypeTree::AccumulateValue< Tree, Functor, Reduction, startValue, ParentChildReduction >

Statically accumulate a value over the nodes of a TypeTree.

This struct implements an algorithm for iterating over a tree and calculating an accumulated value at compile time.

Template Parameters
TreeThe tree to iterate over.
FunctorThe compile-time functor used for visiting each node.

This functor must implement the following interface:

struct AccumulationFunctor
{
// The result type of the overall computation.
typedef ... result_type;
// Decide whether to include the given node in the calculation
// or to skip it.
template<typename Node, typename TreePath>
struct doVisit
{
static const bool value = true;
};
// Calculate the per-node result.
template<typename Node, typename TreePath>
struct visit
{
static const result_type result = ...;
};
};
Functor::result_type result_type
The result type of the computation.
Definition: accumulate_static.hh:262
static const result_type result
The accumulated result of the computation.
Definition: accumulate_static.hh:265
Template Parameters
ReductionThe reduction operator used to accumulate the per-node results.

The reduction operator must implement the following interface:

template<typename result_type>
struct ReductionOperator
{
// combine two per-node results
template<result_type r1, result_type r2>
struct reduce
{
static const result_type result = ...;
};
};
Template Parameters
startValueThe starting value fed into the initial accumulation step.

Member Typedef Documentation

◆ result_type

template<typename Tree , typename Functor , typename Reduction , typename Functor::result_type startValue, typename ParentChildReduction = Reduction>
typedef Functor::result_type Dune::TypeTree::AccumulateValue< Tree, Functor, Reduction, startValue, ParentChildReduction >::result_type

The result type of the computation.

Member Data Documentation

◆ result

template<typename Tree , typename Functor , typename Reduction , typename Functor::result_type startValue, typename ParentChildReduction = Reduction>
const result_type Dune::TypeTree::AccumulateValue< Tree, Functor, Reduction, startValue, ParentChildReduction >::result = accumulate_value<Tree,Functor,Reduction,ParentChildReduction,startValue,HybridTreePath<>,NodeTag<Tree>>::result
static

The accumulated result of the computation.


The documentation for this struct was generated from the following file: