Dune Core Modules (2.6.0)

combinedfunctor.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_AMG_COMBINEDFUNCTOR_HH
4#define DUNE_AMG_COMBINEDFUNCTOR_HH
5
6#include <tuple>
7
9
10namespace Dune
11{
12 namespace Amg
13 {
14
15 template<std::size_t i>
16 struct ApplyHelper
17 {
18 template<class TT, class T>
19 static void apply(TT tuple, const T& t)
20 {
21 std::get<i-1>(tuple) (t);
23 }
24 };
25 template<>
26 struct ApplyHelper<0>
27 {
28 template<class TT, class T>
29 static void apply(TT tuple, const T& t)
30 {
33 }
34 };
35
36 template<typename T>
37 class CombinedFunctor :
38 public T
39 {
40 public:
41 CombinedFunctor(const T& tuple)
42 : T(tuple)
43 {}
44
45 template<class T1>
46 void operator()(const T1& t)
47 {
48 ApplyHelper<std::tuple_size<T>::value>::apply(*this, t);
49 }
50 };
51
52
53 } //namespace Amg
54} // namespace Dune
55#endif
decltype(auto) apply(F &&f, ArgTuple &&args)
Apply function with arguments given as tuple.
Definition: apply.hh:58
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentionally unused function parameters with.
Definition: unused.hh:25
Dune namespace.
Definition: alignedallocator.hh:10
Definition of the DUNE_UNUSED macro for the case that config.h is not available.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)