Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:04

0001 /*!
0002 @file
0003 Forward declares `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_FWD_FUSE_HPP
0011 #define BOOST_HANA_FWD_FUSE_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 
0015 
0016 namespace boost { namespace hana {
0017     //! Transform a function taking multiple arguments into a function that
0018     //! can be called with a compile-time `Foldable`.
0019     //! @ingroup group-Foldable
0020     //!
0021     //!
0022     //! This function is provided for convenience as a different way of
0023     //! calling `unpack`. Specifically, `fuse(f)` is a function such that
0024     //! @code
0025     //!     fuse(f)(foldable) == unpack(foldable, f)
0026     //!                       == f(x...)
0027     //! @endcode
0028     //! where `x...` are the elements in the foldable. This function is
0029     //! useful when one wants to create a function that accepts a foldable
0030     //! which is not known yet.
0031     //!
0032     //! @note
0033     //! This function is not tag-dispatched; customize `unpack` instead.
0034     //!
0035     //!
0036     //! Example
0037     //! -------
0038     //! @include example/fuse.cpp
0039 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0040     constexpr auto fuse = [](auto&& f) {
0041         return [perfect-capture](auto&& xs) -> decltype(auto) {
0042             return unpack(forwarded(xs), forwarded(f));
0043         };
0044     };
0045 #else
0046     struct fuse_t {
0047         template <typename F>
0048         constexpr auto operator()(F&& f) const;
0049     };
0050 
0051     BOOST_HANA_INLINE_VARIABLE constexpr fuse_t fuse{};
0052 #endif
0053 }} // end namespace boost::hana
0054 
0055 #endif // !BOOST_HANA_FWD_FUSE_HPP