Dune Core Modules (2.5.0)

forloop.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
4#ifndef DUNE_COMMON_FORLOOP_HH
5#define DUNE_COMMON_FORLOOP_HH
6
7#include <utility>
8
9#include <dune/common/hybridutilities.hh>
10#include <dune/common/std/utility.hh>
11
16namespace Dune
17{
18
65 template< template< int > class Operation, int first, int last >
66 struct ForLoop
67 {
68 static_assert( (first <= last), "ForLoop: first > last" );
69
70 template<typename... Args>
71 static void apply(Args&&... args)
72 {
73 Hybrid::forEach(Std::make_index_sequence<last+1-first>{},
74 [&](auto i){Operation<i+first>::apply(args...);});
75 }
76 };
77
78}
79
80#endif // #ifndef DUNE_COMMON_FORLOOP_HH
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:314
Dune namespace.
Definition: alignment.hh:11
A static loop using TMP.
Definition: forloop.hh:67
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)