dune-istl  2.2.1
combinedfunctor.hh
Go to the documentation of this file.
1 #ifndef DUNE_AMG_COMBINEDFUNCTOR_HH
2 #define DUNE_AMG_COMBINEDFUNCTOR_HH
3 
4 #include<dune/common/tuples.hh>
5 namespace Dune
6 {
7  namespace Amg
8  {
9 
10  template<std::size_t i>
11  struct ApplyHelper
12  {
13  template<class TT, class T>
14  static void apply(TT tuple, const T& t)
15  {
16  get<i-1>(tuple)(t);
17  ApplyHelper<i-1>::apply(tuple, t);
18  }
19  };
20  template<>
21  struct ApplyHelper<0>
22  {
23  template<class TT, class T>
24  static void apply(TT tuple, const T& t)
25  {}
26  };
27 
28  template<typename T>
30  public T
31  {
32  public:
33  CombinedFunctor(const T& tuple)
34  : T(tuple)
35  {}
36 
37  template<class T1>
38  void operator()(const T1& t)
39  {
40  ApplyHelper<tuple_size<T>::value>::apply(*this, t);
41  }
42  };
43 
44 
45  }//namespace Amg
46 }// namespace Dune
47 #endif