Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*!
0002 @file
0003 Forward declares `boost::hana::extend`.
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_EXTEND_HPP
0011 #define BOOST_HANA_FWD_EXTEND_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Comonadic application of a function to a comonadic value.
0019     //! @ingroup group-Comonad
0020     //!
0021     //! Given a comonadic value and a function accepting a comonadic input,
0022     //! `extend` returns the result of applying the function to that input
0023     //! inside the comonadic context.
0024     //!
0025     //!
0026     //! Signature
0027     //! ---------
0028     //! Given a Comonad `W` and a function of type \f$ W(T) \to U \f$, the
0029     //! signature is
0030     //! \f$
0031     //!     \mathtt{extend} : W(T) \times (W(T) \to U) \to W(U)
0032     //! \f$
0033     //!
0034     //! @param w
0035     //! A comonadic value to call the function with.
0036     //!
0037     //! @param f
0038     //! A function of signature \f$ W(T) \to U \f$ to be applied to its
0039     //! comonadic argument inside the comonadic context.
0040     //!
0041     //!
0042     //! Example
0043     //! -------
0044     //! @include example/extend.cpp
0045 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0046     constexpr auto extend = [](auto&& w, auto&& f) -> decltype(auto) {
0047         return tag-dispatched;
0048     };
0049 #else
0050     template <typename W, typename = void>
0051     struct extend_impl : extend_impl<W, when<true>> { };
0052 
0053     struct extend_t {
0054         template <typename W_, typename F>
0055         constexpr decltype(auto) operator()(W_&& w, F&& f) const;
0056     };
0057 
0058     BOOST_HANA_INLINE_VARIABLE constexpr extend_t extend{};
0059 #endif
0060 }} // end namespace boost::hana
0061 
0062 #endif // !BOOST_HANA_FWD_EXTEND_HPP