DUNE PDELab (git)

combinedfunctor.hh
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_AMG_COMBINEDFUNCTOR_HH
6#define DUNE_AMG_COMBINEDFUNCTOR_HH
7
8#include <tuple>
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);
22 ApplyHelper<i-1>::apply(tuple, t);
23 }
24 };
25 template<>
26 struct ApplyHelper<0>
27 {
28 template<class TT, class T>
29 static void apply([[maybe_unused]] TT tuple, [[maybe_unused]] const T& t)
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<std::tuple_size<T>::value>::apply(*this, t);
46 }
47 };
48
49
50 } //namespace Amg
51} // namespace Dune
52#endif
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)