--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2019 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+#ifndef dealii_cxx17_tuple_h
+#define dealii_cxx17_tuple_h
+
+#include <deal.II/base/config.h>
+
+#ifndef DEAL_II_WITH_CXX17
+# include <deal.II/base/std_cxx14/utility.h>
+#endif
+
+#include <cmath>
+
+DEAL_II_NAMESPACE_OPEN
+namespace std_cxx17
+{
+#ifndef DEAL_II_WITH_CXX17
+ template <typename F, typename Tuple, size_t... S>
+ auto
+ apply_impl(F &&fn, Tuple &&t, std_cxx14::index_sequence<S...>)
+ -> decltype(std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...))
+ {
+ return std::forward<F>(fn)(std::get<S>(std::forward<Tuple>(t))...);
+ }
+
+ template <typename F, typename Tuple>
+ 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>()))
+ {
+ std::size_t constexpr tSize =
+ std::tuple_size<typename std::remove_reference<Tuple>::type>::value;
+ return apply_impl(std::forward<F>(fn),
+ std::forward<Tuple>(t),
+ std_cxx14::make_index_sequence<tSize>());
+ }
+#else
+ using std::apply;
+#endif // DEAL_II_WITH_CXX17
+} // namespace std_cxx17
+DEAL_II_NAMESPACE_CLOSE
+
+#endif
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 - 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// test the implementation of the std_cxx17::apply function
+
+
+#include <deal.II/base/point.h>
+#include <deal.II/base/std_cxx17/tuple.h>
+
+#include "../tests.h"
+
+
+void
+example_function(const Point<2> &p, const double &d, const unsigned int i = 3)
+{
+ deallog << "P: " << p << ", d: " << d << ", i: " << i << std::endl;
+}
+
+
+int
+main()
+{
+ initlog();
+ auto tup = std::make_tuple(Point<2>(.5, .5), 2.0, 3u);
+ std_cxx17::apply(example_function, tup);
+}