dune-common  2.6-git
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 #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 
14 
15 namespace 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
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:308
static void apply(Args &&... args)
Definition: forloop.hh:24
decltype(auto) apply(F &&f, ArgTuple &&args)
Apply function with arguments given as tuple.
Definition: apply.hh:58
Dune namespace.
Definition: alignedallocator.hh:9
#define DUNE_DEPRECATED_MSG(text)
Mark some entity as deprecated.
Definition: deprecated.hh:169
Definition: forloop.hh:19
Definition of the DUNE_DEPRECATED macro for the case that config.h is not available.