dune-common  2.7.0
apply.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 #ifndef DUNE_COMMON_STD_APPLY_HH
4 #define DUNE_COMMON_STD_APPLY_HH
5 
6 #if DUNE_HAVE_CXX_APPLY
7  #include <tuple>
8 #elif DUNE_HAVE_CXX_EXPERIMENTAL_APPLY
9  #include <experimental/tuple>
10 #else
11  #include <cstddef>
12  #include <utility>
13  #include <tuple>
14 #endif
15 
17 
18 
19 namespace Dune
20 {
21 
22  namespace Std
23  {
24 
25 #if DUNE_HAVE_CXX_APPLY
26 
27  using std::apply;
28 
29 #elif DUNE_HAVE_CXX_EXPERIMENTAL_APPLY
30 
32 
33 #else
34 
45  template<class F, class ArgTuple>
46  decltype(auto) apply(F&& f, ArgTuple&& args)
47  {
48  auto indices = std::make_index_sequence<std::tuple_size<std::decay_t<ArgTuple>>::value>();
49  return applyPartial(std::forward<F>(f), std::forward<ArgTuple>(args), indices);
50  }
51 
52 #endif
53 
54  } // namespace Std
55 } // namespace Dune
56 
57 #endif // #ifndef DUNE_COMMON_STD_APPLY_HH
Dune::Std::apply
decltype(auto) apply(F &&f, ArgTuple &&args)
Apply function with arguments given as tuple.
Definition: apply.hh:46
tupleutility.hh
Contains utility classes which can be used with std::tuple.
Dune::applyPartial
decltype(auto) applyPartial(F &&f, ArgTuple &&args, std::integer_sequence< I, i... >)
Apply function with arguments from a given tuple.
Definition: tupleutility.hh:40
Dune
Dune namespace.
Definition: alignedallocator.hh:13