00001
00002
00003
00004 #ifndef DUNE_COMMON_FORLOOP_HH
00005 #define DUNE_COMMON_FORLOOP_HH
00006
00007 #include <utility>
00008
00009 #include <dune/common/hybridutilities.hh>
00010 #include <dune/common/std/utility.hh>
00011
00016 namespace Dune
00017 {
00018
00065 template< template< int > class Operation, int first, int last >
00066 struct ForLoop
00067 {
00068 static_assert( (first <= last), "ForLoop: first > last" );
00069
00070 template<typename... Args>
00071 static void apply(Args&&... args)
00072 {
00073 Hybrid::forEach(Std::make_index_sequence<last+1-first>{},
00074 [&](auto i){Operation<i+first>::apply(args...);});
00075 }
00076 };
00077
00078 }
00079
00080 #endif // #ifndef DUNE_COMMON_FORLOOP_HH