3 Forward declares `boost::hana::div`.
5 @copyright Louis Dionne 2013-2017
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_DIV_HPP
11 #define BOOST_HANA_FWD_DIV_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 namespace boost { namespace hana {
18 //! Generalized integer division.
19 //! @ingroup group-EuclideanRing
22 //! Cross-type version of the method
23 //! --------------------------------
24 //! The `div` method is "overloaded" to handle distinct data types
25 //! with certain properties. Specifically, `div` is defined for
26 //! _distinct_ data types `A` and `B` such that
27 //! 1. `A` and `B` share a common data type `C`, as determined by the
28 //! `common` metafunction
29 //! 2. `A`, `B` and `C` are all `EuclideanRing`s when taken individually
30 //! 3. `to<C> : A -> B` and `to<C> : B -> C` are `Ring`-embeddings, as
31 //! determined by the `is_embedding` metafunction.
33 //! In that case, the `div` method is defined as
35 //! div(x, y) = div(to<C>(x), to<C>(y))
41 //! @include example/div.cpp
42 #ifdef BOOST_HANA_DOXYGEN_INVOKED
43 constexpr auto div = [](auto&& x, auto&& y) -> decltype(auto) {
44 return tag-dispatched;
47 template <typename T, typename U, typename = void>
48 struct div_impl : div_impl<T, U, when<true>> { };
51 template <typename X, typename Y>
52 constexpr decltype(auto) operator()(X&& x, Y&& y) const;
55 BOOST_HANA_INLINE_VARIABLE constexpr div_t div{};
57 }} // end namespace boost::hana
59 #endif // !BOOST_HANA_FWD_DIV_HPP