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