dune-common  2.2.0
Classes | Public Member Functions | List of all members
Dune::TransformTupleFunctor< TE, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 > Class Template Reference

helper class to implement transformTuple() More...

#include <dune/common/tupleutility.hh>

Classes

struct  TypeEvaluator
 export the TypeEvaluator template class for genericTransformTuple() More...

Public Member Functions

 TransformTupleFunctor (A0 &a0_, A1 &a1_, A2 &a2_, A3 &a3_, A4 &a4_, A5 &a5_, A6 &a6_, A7 &a7_, A8 &a8_, A9 &a9_)
 constructor
template<class T >
TE< T >::Type operator() (T &t) const
 call TE<T>::apply(t,args...)

Detailed Description

template<template< class > class TE, class A0 = void, class A1 = void, class A2 = void, class A3 = void, class A4 = void, class A5 = void, class A6 = void, class A7 = void, class A8 = void, class A9 = void>
class Dune::TransformTupleFunctor< TE, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 >

helper class to implement transformTuple()

 \tparam TE TypeEvaluator class template.
 \tparam An Type of extra arguments to pass to \c TE<T>::apply().  \c void
            means "no argument".  Only trailing arguments may be void.

 This class stores references to a number of arguments it receives in the
 constructor.  Later, its function call operator \c operator() may be
 called with a parameter \c t of type \c T.  \c operator() will then call
 the static method \c TE<T>::apply(t,args...), where \c args... is the
 sequence of arguments the object was constructed with.  \c operator()
 will convert the result to type \c TE<T>::Type and return it.

 \c TE should be an extended version of the \c TypeEvaluator class
 template parameter of ForEachType, for instance:
 @code 

template <class t>=""> struct TypeEvaluator { typedef T* Type; static Type apply(T& t, void* a0) { return t ? &t : static_cast<T*>(a0); } }; This example is for a TransformTupleFunctor with one argument, i.e. A0!=void and all other An=void. For the type transformation, it will transform a value of some type T into a pointer to T. For the value transformation, it will take a reference to a value of type T and return the pointer to that value, unless the value evaluates to false in boolean context. If the value evaluates to false, it will instead return the pointer from the extra argument.

Constructor & Destructor Documentation

template<template< class > class TE, class A0 = void, class A1 = void, class A2 = void, class A3 = void, class A4 = void, class A5 = void, class A6 = void, class A7 = void, class A8 = void, class A9 = void>
Dune::TransformTupleFunctor< TE, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 >::TransformTupleFunctor ( A0 &  a0_,
A1 &  a1_,
A2 &  a2_,
A3 &  a3_,
A4 &  a4_,
A5 &  a5_,
A6 &  a6_,
A7 &  a7_,
A8 &  a8_,
A9 &  a9_ 
)
inline

constructor

The actual number of arguments varies between specializations, the actual number of arguments here is equal to the number of non-void class template arguments An.

Member Function Documentation

template<template< class > class TE, class A0 = void, class A1 = void, class A2 = void, class A3 = void, class A4 = void, class A5 = void, class A6 = void, class A7 = void, class A8 = void, class A9 = void>
template<class T >
TE<T>::Type Dune::TransformTupleFunctor< TE, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 >::operator() ( T &  t) const
inline

call TE<T>::apply(t,args...)

This calls the static apply method of the TypeEvaluator class template.

Note
There is no need to overload operator() with at const T& argument, since genericTransformTuple() will always use an lvalue argument.

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