3 Forward declares `boost::hana::minus`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_MINUS_HPP
11 #define BOOST_HANA_FWD_MINUS_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Subtract two elements of a group.
19 //! @ingroup group-Group
21 //! Specifically, this performs the `Monoid` operation on the first
22 //! argument and on the inverse of the second argument, thus being
25 //! minus(x, y) == plus(x, negate(y))
29 //! Cross-type version of the method
30 //! --------------------------------
31 //! The `minus` method is "overloaded" to handle distinct data types
32 //! with certain properties. Specifically, `minus` is defined for
33 //! _distinct_ data types `A` and `B` such that
34 //! 1. `A` and `B` share a common data type `C`, as determined by the
35 //! `common` metafunction
36 //! 2. `A`, `B` and `C` are all `Group`s when taken individually
37 //! 3. `to<C> : A -> B` and `to<C> : B -> C` are `Group`-embeddings, as
38 //! determined by the `is_embedding` metafunction.
40 //! The definition of `minus` for data types satisfying the above
41 //! properties is obtained by setting
43 //! minus(x, y) = minus(to<C>(x), to<C>(y))
49 //! @include example/minus.cpp
50 #ifdef BOOST_HANA_DOXYGEN_INVOKED
51 constexpr auto minus = [](auto&& x, auto&& y) -> decltype(auto) {
52 return tag-dispatched;
55 template <typename T, typename U, typename = void>
56 struct minus_impl : minus_impl<T, U, when<true>> { };
59 template <typename X, typename Y>
60 constexpr decltype(auto) operator()(X&& x, Y&& y) const;
63 constexpr minus_t minus{};
65 BOOST_HANA_NAMESPACE_END
67 #endif // !BOOST_HANA_FWD_MINUS_HPP