]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/fwd/mod.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / mod.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Forward declares `boost::hana::mod`.
4
5@copyright Louis Dionne 2013-2016
6Distributed 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_MOD_HPP
11#define BOOST_HANA_FWD_MOD_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/when.hpp>
15
16
17BOOST_HANA_NAMESPACE_BEGIN
18 //! Generalized integer modulus.
19 //! @ingroup group-EuclideanRing
20 //!
21 //! Given two elements of an EuclideanRing `x` and `y`, with `y`
22 //! nonzero, `mod` returns the modulus of the division of `x` by `y`.
23 //! In other words, `mod` can be seen as an equivalent to `%`.
24 //!
25 //! Cross-type version of the method
26 //! --------------------------------
27 //! The `mod` method is "overloaded" to handle distinct data types
28 //! with certain properties. Specifically, `mod` is defined for
29 //! _distinct_ data types `A` and `B` such that
30 //! 1. `A` and `B` share a common data type `C`, as determined by the
31 //! `common` metafunction
32 //! 2. `A`, `B` and `C` are all `EuclideanRing`s when taken individually
33 //! 3. `to<C> : A -> B` and `to<C> : B -> C` are `Ring`-embeddings, as
34 //! determined by the `is_embedding` metafunction.
35 //!
36 //! In that case, `mod` is defined as
37 //! @code
38 //! mod(x, y) = mod(to<C>(x), to<C>(y))
39 //! @endcode
40 //!
41 //!
42 //! Example
43 //! -------
44 //! @include example/mod.cpp
45#ifdef BOOST_HANA_DOXYGEN_INVOKED
46 constexpr auto mod = [](auto&& x, auto&& y) -> decltype(auto) {
47 return tag-dispatched;
48 };
49#else
50 template <typename T, typename U, typename = void>
51 struct mod_impl : mod_impl<T, U, when<true>> { };
52
53 struct mod_t {
54 template <typename X, typename Y>
55 constexpr decltype(auto) operator()(X&& x, Y&& y) const;
56 };
57
58 constexpr mod_t mod{};
59#endif
60BOOST_HANA_NAMESPACE_END
61
62#endif // !BOOST_HANA_FWD_MOD_HPP