dune-istl  2.3.1
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 <dune/common/tuples.hh>
7 namespace 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  {
28  DUNE_UNUSED_PARAMETER(tuple);
29  DUNE_UNUSED_PARAMETER(t);
30  }
31  };
32 
33  template<typename T>
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