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::extract`.
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_EXTRACT_HPP
0011 #define BOOST_HANA_FWD_EXTRACT_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Extract a value in a given comonadic context.
0019     //! @ingroup group-Comonad
0020     //!
0021     //! Given a value inside a comonadic context, extract it from that
0022     //! context, performing whatever effects are mandated by that context.
0023     //! This can be seen as the dual operation to the `lift` method of the
0024     //! Applicative concept.
0025     //!
0026     //!
0027     //! Signature
0028     //! ---------
0029     //! Given a Comonad `W`, the signature is
0030     //! \f$
0031     //!     \mathtt{extract} : W(T) \to T
0032     //! \f$
0033     //!
0034     //! @param w
0035     //! The value to be extracted inside a comonadic context.
0036     //!
0037     //!
0038     //! Example
0039     //! -------
0040     //! @include example/extract.cpp
0041 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0042     constexpr auto extract = [](auto&& w) -> decltype(auto) {
0043         return tag-dispatched;
0044     };
0045 #else
0046     template <typename W, typename = void>
0047     struct extract_impl : extract_impl<W, when<true>> { };
0048 
0049     struct extract_t {
0050         template <typename W_>
0051         constexpr decltype(auto) operator()(W_&& w) const;
0052     };
0053 
0054     BOOST_HANA_INLINE_VARIABLE constexpr extract_t extract{};
0055 #endif
0056 }} // end namespace boost::hana
0057 
0058 #endif // !BOOST_HANA_FWD_EXTRACT_HPP