Dune Core Modules (2.4.1)

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
7namespace Dune
8{
9 namespace Amg
10 {
11
12 template<std::size_t i>
13 struct ApplyHelper
14 {
15 template<class TT, class T>
16 static void apply(TT tuple, const T& t)
17 {
18 get<i-1>(tuple) (t);
19 ApplyHelper<i-1>::apply(tuple, t);
20 }
21 };
22 template<>
23 struct ApplyHelper<0>
24 {
25 template<class TT, class T>
26 static void apply(TT tuple, const T& t)
27 {
30 }
31 };
32
33 template<typename T>
34 class CombinedFunctor :
35 public T
36 {
37 public:
38 CombinedFunctor(const T& tuple)
39 : T(tuple)
40 {}
41
42 template<class T1>
43 void operator()(const T1& t)
44 {
45 ApplyHelper<tuple_size<T>::value>::apply(*this, t);
46 }
47 };
48
49
50 } //namespace Amg
51} // namespace Dune
52#endif
Dune namespace.
Definition: alignment.hh:10
Fallback implementation of the std::tuple class.
#define DUNE_UNUSED_PARAMETER(parm)
A macro to mark intentional unused function parameters with.
Definition: unused.hh:18
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)