Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:43:36

0001 /*!
0002 @file
0003 Defines `boost::hana::fuse`.
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_FUSE_HPP
0011 #define BOOST_HANA_FUSE_HPP
0012 
0013 #include <boost/hana/fwd/fuse.hpp>
0014 
0015 #include <boost/hana/config.hpp>
0016 #include <boost/hana/detail/decay.hpp>
0017 #include <boost/hana/unpack.hpp>
0018 
0019 
0020 namespace boost { namespace hana {
0021     namespace detail {
0022         template <typename F>
0023         struct fused {
0024             F f;
0025             template <typename Xs>
0026             constexpr decltype(auto) operator()(Xs&& xs) const&
0027             { return hana::unpack(static_cast<Xs&&>(xs), f); }
0028 
0029             template <typename Xs>
0030             constexpr decltype(auto) operator()(Xs&& xs) &
0031             { return hana::unpack(static_cast<Xs&&>(xs), f); }
0032 
0033             template <typename Xs>
0034             constexpr decltype(auto) operator()(Xs&& xs) &&
0035             { return hana::unpack(static_cast<Xs&&>(xs), static_cast<F&&>(f)); }
0036         };
0037     }
0038 
0039     //! @cond
0040     template <typename F>
0041     constexpr auto fuse_t::operator()(F&& f) const {
0042         return detail::fused<typename detail::decay<F>::type>{static_cast<F&&>(f)};
0043     }
0044     //! @endcond
0045 }} // end namespace boost::hana
0046 
0047 #endif // !BOOST_HANA_FUSE_HPP