]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/fwd/div.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / hana / fwd / div.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::div`.
4
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)
8 */
9
10 #ifndef BOOST_HANA_FWD_DIV_HPP
11 #define BOOST_HANA_FWD_DIV_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16
17 namespace boost { namespace hana {
18 //! Generalized integer division.
19 //! @ingroup group-EuclideanRing
20 //!
21 //!
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.
32 //!
33 //! In that case, the `div` method is defined as
34 //! @code
35 //! div(x, y) = div(to<C>(x), to<C>(y))
36 //! @endcode
37 //!
38 //!
39 //! Example
40 //! -------
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;
45 };
46 #else
47 template <typename T, typename U, typename = void>
48 struct div_impl : div_impl<T, U, when<true>> { };
49
50 struct div_t {
51 template <typename X, typename Y>
52 constexpr decltype(auto) operator()(X&& x, Y&& y) const;
53 };
54
55 BOOST_HANA_INLINE_VARIABLE constexpr div_t div{};
56 #endif
57 }} // end namespace boost::hana
58
59 #endif // !BOOST_HANA_FWD_DIV_HPP