Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:13:44

0001 /*!
0002 @file
0003 Forward declares `boost::hana::minus`.
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_MINUS_HPP
0011 #define BOOST_HANA_FWD_MINUS_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Subtract two elements of a group.
0019     //! @ingroup group-Group
0020     //!
0021     //! Specifically, this performs the `Monoid` operation on the first
0022     //! argument and on the inverse of the second argument, thus being
0023     //! equivalent to:
0024     //! @code
0025     //!     minus(x, y) == plus(x, negate(y))
0026     //! @endcode
0027     //!
0028     //!
0029     //! Cross-type version of the method
0030     //! --------------------------------
0031     //! The `minus` method is "overloaded" to handle distinct data types
0032     //! with certain properties. Specifically, `minus` is defined for
0033     //! _distinct_ data types `A` and `B` such that
0034     //! 1. `A` and `B` share a common data type `C`, as determined by the
0035     //!    `common` metafunction
0036     //! 2. `A`, `B` and `C` are all `Group`s when taken individually
0037     //! 3. `to<C> : A -> B` and `to<C> : B -> C` are `Group`-embeddings, as
0038     //!    determined by the `is_embedding` metafunction.
0039     //!
0040     //! The definition of `minus` for data types satisfying the above
0041     //! properties is obtained by setting
0042     //! @code
0043     //!     minus(x, y) = minus(to<C>(x), to<C>(y))
0044     //! @endcode
0045     //!
0046     //!
0047     //! Example
0048     //! -------
0049     //! @include example/minus.cpp
0050 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0051     constexpr auto minus = [](auto&& x, auto&& y) -> decltype(auto) {
0052         return tag-dispatched;
0053     };
0054 #else
0055     template <typename T, typename U, typename = void>
0056     struct minus_impl : minus_impl<T, U, when<true>> { };
0057 
0058     struct minus_t {
0059         template <typename X, typename Y>
0060         constexpr decltype(auto) operator()(X&& x, Y&& y) const;
0061     };
0062 
0063     BOOST_HANA_INLINE_VARIABLE constexpr minus_t minus{};
0064 #endif
0065 }} // end namespace boost::hana
0066 
0067 #endif // !BOOST_HANA_FWD_MINUS_HPP