Dune Core Modules (2.4.1)

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 More...
 
template<class T >
TE< T >::Type operator() (T &t) const
 call TE<T>::apply(t,args...) More...
 

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()

Template Parameters
TETypeEvaluator class template.
AnType of extra arguments to pass to TE<T>::apply(). 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 operator() may be called with a parameter t of type T. operator() will then call the static method TE<T>::apply(t,args...), where args... is the sequence of arguments the object was constructed with. operator() will convert the result to type TE<T>::Type and return it.

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

template <class T>
struct TypeEvaluator {
typedef T* Type;
static Type apply(T& t, void* a0) {
return t ? &t : static_cast<T*>(a0);
}
};
export the TypeEvaluator template class for genericTransformTuple()
Definition: tupleutility.hh:699

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

◆ TransformTupleFunctor()

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

◆ operator()()

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:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)