dune-common
2.3.0
|
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...) |
helper class to implement transformTuple()
TE | TypeEvaluator class template. |
An | Type 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:
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.
|
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
.
|
inline |
call TE<T>::apply
(t,args...)
This calls the static apply method of the TypeEvaluator class template.
operator()
with at const
T&
argument, since genericTransformTuple() will always use an lvalue argument.