dune-fem 2.8.0
Loading...
Searching...
No Matches
forloop.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_FORLOOP_HH
2#define DUNE_FEM_FORLOOP_HH
3
4#include <utility>
5
6#include <dune/common/visibility.hh>
7#include <dune/common/deprecated.hh>
8#include <dune/common/hybridutilities.hh>
9
10namespace Dune
11{
12
13 namespace Fem {
14
15 template< template< int > class Operation, int first, int last >
16 struct ForLoop
17 {
18 static_assert( (first <= last), "Fem::Fem::ForLoop: first > last" );
19
20 static const std::size_t N = last + 1 - first;
21
22 template<typename... Args>
23 static DUNE_PRIVATE void apply(Args&&... args)
24 {
25 Dune::Hybrid::forEach(std::make_index_sequence<N>{},
26 [&](auto i){Operation<i+first>::apply(args...);});
27 }
28 };
29
30 } // end namespace Fem
31} // end namespace Dune
32#endif // #ifndef DUNE_FEM_FORLOOP_HH
Definition: bindguard.hh:11
static void forEach(IndexRange< T, sz > range, F &&f)
Definition: hybrid.hh:129
Definition: forloop.hh:17
static DUNE_PRIVATE void apply(Args &&... args)
Definition: forloop.hh:23
static const std::size_t N
Definition: forloop.hh:20