]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*! |
2 | @file | |
3 | Defines `boost::hana::detail::variadic::reverse_apply_flat`. | |
4 | ||
5 | @copyright Louis Dionne 2013-2016 | |
6 | Distributed under the Boost Software License, Version 1.0. | |
7 | (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
8 | */ | |
9 | ||
10 | #ifndef BOOST_HANA_DETAIL_VARIADIC_REVERSE_APPLY_FLAT_HPP | |
11 | #define BOOST_HANA_DETAIL_VARIADIC_REVERSE_APPLY_FLAT_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/detail/variadic/at.hpp> | |
15 | ||
16 | #include <utility> | |
17 | ||
18 | ||
19 | BOOST_HANA_NAMESPACE_BEGIN namespace detail { namespace variadic { | |
20 | template <int ...i, typename F, typename ...X> | |
21 | constexpr decltype(auto) | |
22 | reverse_apply_flat_helper(std::integer_sequence<int, i...>, F&& f, X&& ...x) | |
23 | { | |
24 | return static_cast<F&&>(f)( | |
25 | detail::variadic::at<sizeof...(x) - i - 1>( | |
26 | static_cast<X&&>(x)... | |
27 | )... | |
28 | ); | |
29 | } | |
30 | ||
31 | template <typename F, typename ...X> | |
32 | constexpr decltype(auto) reverse_apply_flat(F&& f, X&& ...x) { | |
33 | return reverse_apply_flat_helper( | |
34 | std::make_integer_sequence<int, sizeof...(x)>{}, | |
35 | static_cast<F&&>(f), | |
36 | static_cast<X&&>(x)... | |
37 | ); | |
38 | } | |
39 | }} BOOST_HANA_NAMESPACE_END | |
40 | ||
41 | #endif // !BOOST_HANA_DETAIL_VARIADIC_REVERSE_APPLY_FLAT_HPP |