Dune Core Modules (2.6.0)

forloop.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#warning The header dune/common/forloop.hh is deprecated. Use directly "Hybrid::forEach" and include dune/common/hybridutilities.hh.
5
6#ifndef DUNE_COMMON_FORLOOP_HH
7#define DUNE_COMMON_FORLOOP_HH
8
9#include <utility>
10
12#include <dune/common/hybridutilities.hh>
13#include <dune/common/std/utility.hh>
14
15namespace Dune
16{
17
18 template< template< int > class Operation, int first, int last >
19 struct DUNE_DEPRECATED_MSG("Use Hybrid::forEach instead!") ForLoop
20 {
21 static_assert( (first <= last), "ForLoop: first > last" );
22
23 template<typename... Args>
24 static void apply(Args&&... args)
25 {
26 Hybrid::forEach(Std::make_index_sequence<last+1-first>{},
27 [&](auto i){Operation<i+first>::apply(args...);});
28 }
29 };
30
31}
32
33#endif // #ifndef DUNE_COMMON_FORLOOP_HH
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.
decltype(auto) apply(F &&f, ArgTuple &&args)
Apply function with arguments given as tuple.
Definition: apply.hh:58
#define DUNE_DEPRECATED_MSG(text)
Mark some entity as deprecated.
Definition: deprecated.hh:169
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:308
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)