dune-istl  2.8.0
combinedfunctor.hh
Go to the documentation of this file.
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 
8 namespace 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>
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
Definition: allocator.hh:9
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get([[maybe_unused]] const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition: dependency.hh:291
Definition: combinedfunctor.hh:15
static void apply(TT tuple, const T &t)
Definition: combinedfunctor.hh:17
static void apply([[maybe_unused]] TT tuple, [[maybe_unused]] const T &t)
Definition: combinedfunctor.hh:27
Definition: combinedfunctor.hh:34
CombinedFunctor(const T &tuple_)
Definition: combinedfunctor.hh:36
void operator()(const T1 &t)
Definition: combinedfunctor.hh:41