Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:37:41

0001 /*!
0002 @file
0003 Defines `boost::hana::detail::variadic::reverse_apply_unrolled`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_DETAIL_VARIADIC_REVERSE_APPLY_UNROLLED_HPP
0011 #define BOOST_HANA_DETAIL_VARIADIC_REVERSE_APPLY_UNROLLED_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/functional/reverse_partial.hpp>
0015 
0016 
0017 namespace boost { namespace hana { namespace detail { namespace variadic {
0018     struct reverse_apply_unrolled_impl {
0019         template <typename F>
0020         constexpr decltype(auto) operator()(F&& f) const {
0021             return static_cast<F&&>(f)();
0022         }
0023 
0024         template <typename F, typename X1>
0025         constexpr decltype(auto) operator()(F&& f, X1&& x1) const {
0026             return static_cast<F&&>(f)(
0027                 static_cast<X1&&>(x1)
0028             );
0029         }
0030 
0031         template <typename F, typename X1, typename X2>
0032         constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2) const {
0033             return static_cast<F&&>(f)(
0034                 static_cast<X2&&>(x2),
0035                 static_cast<X1&&>(x1)
0036             );
0037         }
0038 
0039         template <typename F, typename X1, typename X2, typename X3>
0040         constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3) const {
0041             return static_cast<F&&>(f)(
0042                 static_cast<X3&&>(x3),
0043                 static_cast<X2&&>(x2),
0044                 static_cast<X1&&>(x1)
0045             );
0046         }
0047 
0048         template <typename F, typename X1, typename X2, typename X3, typename X4>
0049         constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4) const {
0050             return static_cast<F&&>(f)(
0051                 static_cast<X4&&>(x4),
0052                 static_cast<X3&&>(x3),
0053                 static_cast<X2&&>(x2),
0054                 static_cast<X1&&>(x1)
0055             );
0056         }
0057 
0058         template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5>
0059         constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5) const {
0060             return static_cast<F&&>(f)(
0061                 static_cast<X5&&>(x5),
0062                 static_cast<X4&&>(x4),
0063                 static_cast<X3&&>(x3),
0064                 static_cast<X2&&>(x2),
0065                 static_cast<X1&&>(x1)
0066             );
0067         }
0068 
0069         template <typename F, typename X1, typename X2, typename X3, typename X4, typename X5, typename X6, typename ...Xn>
0070         constexpr decltype(auto) operator()(F&& f, X1&& x1, X2&& x2, X3&& x3, X4&& x4, X5&& x5, X6&& x6, Xn&& ...xn) const {
0071             return (*this)(hana::reverse_partial(
0072                   static_cast<F&&>(f)
0073                 , static_cast<X6&&>(x6)
0074                 , static_cast<X5&&>(x5)
0075                 , static_cast<X4&&>(x4)
0076                 , static_cast<X3&&>(x3)
0077                 , static_cast<X2&&>(x2)
0078                 , static_cast<X1&&>(x1)
0079             ), static_cast<Xn&&>(xn)...);
0080         }
0081     };
0082 
0083     BOOST_HANA_INLINE_VARIABLE constexpr reverse_apply_unrolled_impl reverse_apply_unrolled{};
0084 }} }} // end namespace boost::hana
0085 
0086 #endif // !BOOST_HANA_DETAIL_VARIADIC_REVERSE_APPLY_UNROLLED_HPP