Reference documentation for deal.II version 9.2.0
\(\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 
22 #ifndef __cpp_lib_apply
24 #endif // __cpp_lib_apply
25 
27 namespace std_cxx17
28 {
29 #ifndef __cpp_lib_apply
30  template <typename F, typename Tuple, size_t... S>
31  auto
32  apply_impl(F &&fn, Tuple &&t, std_cxx14::index_sequence<S...>)
33  -> decltype(std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...))
34  {
35  return std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...);
36  }
37 
38  template <typename F, typename Tuple>
39  auto
40  apply(F &&fn, Tuple &&t) -> decltype(apply_impl(
41  std::forward<F>(fn),
42  std::forward<Tuple>(t),
43  std_cxx14::make_index_sequence<
44  std::tuple_size<typename std::remove_reference<Tuple>::type>::value>()))
45  {
46  std::size_t constexpr tSize =
47  std::tuple_size<typename std::remove_reference<Tuple>::type>::value;
48  return apply_impl(std::forward<F>(fn),
49  std::forward<Tuple>(t),
50  std_cxx14::make_index_sequence<tSize>());
51  }
52 #else
53  using std::apply;
54 #endif // __cpp_lib_apply
55 } // namespace std_cxx17
57 
58 #endif
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
auto apply_impl(F &&fn, Tuple &&t, std_cxx14::index_sequence< S... >) -> decltype(std::forward< F >(fn)(std::get< S >(std::forward< Tuple >(t))...))
Definition: tuple.h:32
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
auto apply(F &&fn, Tuple &&t) -> decltype(apply_impl(std::forward< F >(fn), std::forward< Tuple >(t), std_cxx14::make_index_sequence< std::tuple_size< typename std::remove_reference< Tuple >::type >::value >()))
Definition: tuple.h:40
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Definition: c++.h:153
static const bool value