Loading...
Searching...
No Matches
Dune::TransformTupleFunctor< TE, Args > Class Template Reference
Common » Utilities » Tuple Utilities

`#include <dune/common/tupleutility.hh>`

## Classes

struct | TypeEvaluator

## Public Member Functions

| TransformTupleFunctor (Args &&... args)
template<class T>
auto | operator() (T &&t) -> decltype(this->apply(t, std::index_sequence_for< Args... >{})) const

## Detailed Description

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

Template Parameters

  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:

template <class T>
struct TypeEvaluator
{
typedef T* Type;
static Type apply(T& t, void* a0)
{
return t ? &t : static_cast<T*>(a0);
}
};
Dune::TransformTupleFunctor::TypeEvaluator
Definition tupleutility.hh:239

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:

- tupleutility.hh