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::mult`.
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_MULT_HPP
0011 #define BOOST_HANA_FWD_MULT_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Associative operation of a `Ring`.
0019     //! @ingroup group-Ring
0020     //!
0021     //! @param x, y
0022     //! Two `Ring` elements to combine with the `Ring` binary operation.
0023     //!
0024     //!
0025     //! Cross-type version of the method
0026     //! --------------------------------
0027     //! The `mult` method is "overloaded" to handle distinct data types
0028     //! with certain properties. Specifically, `mult` is defined for
0029     //! _distinct_ data types `A` and `B` such that
0030     //! 1. `A` and `B` share a common data type `C`, as determined by the
0031     //!    `common` metafunction
0032     //! 2. `A`, `B` and `C` are all `Ring`s when taken individually
0033     //! 3. `to<C> : A -> B` and `to<C> : B -> C` are `Ring`-embeddings, as
0034     //!    determined by the `is_embedding` metafunction.
0035     //!
0036     //! The definition of `mult` for data types satisfying the above
0037     //! properties is obtained by setting
0038     //! @code
0039     //!     mult(x, y) = mult(to<C>(x), to<C>(y))
0040     //! @endcode
0041     //!
0042     //!
0043     //! Example
0044     //! -------
0045     //! @include example/mult.cpp
0046 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0047     constexpr auto mult = [](auto&& x, auto&& y) -> decltype(auto) {
0048         return tag-dispatched;
0049     };
0050 #else
0051     template <typename T, typename U, typename = void>
0052     struct mult_impl : mult_impl<T, U, when<true>> { };
0053 
0054     struct mult_t {
0055         template <typename X, typename Y>
0056         constexpr decltype(auto) operator()(X&& x, Y&& y) const;
0057     };
0058 
0059     BOOST_HANA_INLINE_VARIABLE constexpr mult_t mult{};
0060 #endif
0061 }} // end namespace boost::hana
0062 
0063 #endif // !BOOST_HANA_FWD_MULT_HPP