Reference documentation for deal.II version Git ee8a81293c 2020-10-19 10:17:29 -0400
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
tuple.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 #ifndef dealii_cxx17_tuple_h
16 #define dealii_cxx17_tuple_h
17 
18 #include <deal.II/base/config.h>
19 
20 #include <tuple>
21 
23 namespace std_cxx17
24 {
25 #ifndef DEAL_II_HAVE_CXX17
26  template <typename F, typename Tuple, size_t... S>
27  auto
28  apply_impl(F &&fn, Tuple &&t, std::index_sequence<S...>)
29  -> decltype(std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...))
30  {
31  return std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...);
32  }
33 
34  template <typename F, typename Tuple>
35  auto
36  apply(F &&fn, Tuple &&t) -> decltype(apply_impl(
37  std::forward<F>(fn),
38  std::forward<Tuple>(t),
39  std::make_index_sequence<
40  std::tuple_size<typename std::remove_reference<Tuple>::type>::value>()))
41  {
42  std::size_t constexpr tSize =
43  std::tuple_size<typename std::remove_reference<Tuple>::type>::value;
44  return apply_impl(std::forward<F>(fn),
45  std::forward<Tuple>(t),
46  std::make_index_sequence<tSize>());
47  }
48 #else
49  using std::apply;
50 #endif
51 } // namespace std_cxx17
53 
54 #endif
auto apply_impl(F &&fn, Tuple &&t, std::index_sequence< S... >) -> decltype(std::forward< F >(fn)(std::get< S >(std::forward< Tuple >(t))...))
Definition: tuple.h:28
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
auto apply(F &&fn, Tuple &&t) -> decltype(apply_impl(std::forward< F >(fn), std::forward< Tuple >(t), std::make_index_sequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
Definition: tuple.h:36
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:369
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:368
Definition: c++.h:153