Dune Core Modules (2.8.0)

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.
 

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.
 

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.

The documentation for this struct was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)