Dune Core Modules (2.6.0)

Dune::TransformTupleFunctor< TE, Args > Class Template Reference

#include <dune/common/tupleutility.hh>

Detailed Description

template<template< class > class TE, class... Args>
class Dune::TransformTupleFunctor< TE, Args >

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);
}
};
decltype(auto) apply(F &&f, ArgTuple &&args)
Apply function with arguments given as tuple.
Definition: apply.hh:58

In this example, for the value transformation, it takes 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.


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.80.0 (Apr 18, 22:30, 2024)