dune-typetree  2.3.1
Public Types | Static Public Member Functions | List of all members
Dune::TypeTree::OptionalChild< T > Struct Template Reference

Implementation Helper for constructors of composite nodes. More...

#include <dune/typetree/compositenode.hh>

Public Types

typedef T & type
 The correct child type. More...
 

Static Public Member Functions

static T default_value ()
 Method providing a default value for empty children. More...
 

Detailed Description

template<typename T>
struct Dune::TypeTree::OptionalChild< T >

Implementation Helper for constructors of composite nodes.

Using this struct for all but the first constructor argument in a composite node implementation makes it possible to only have a single constructor regardless of the number of actual children of the node.

It should be used like this:

template<typename C1, typename C2, ...>
class MyCompositeNode {
...
MyCompositeNode(C1& c1,
typename OptionalChild<C2>::type c2 = OptionalChild<C2>::default_value(),
...)
: BaseT(c1,c2,...)
{}
};

Member Typedef Documentation

template<typename T>
typedef T& Dune::TypeTree::OptionalChild< T >::type

The correct child type.

Member Function Documentation

template<typename T>
static T Dune::TypeTree::OptionalChild< T >::default_value ( )
inlinestatic

Method providing a default value for empty children.

References value.


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