]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/ext/std/ratio/arithmetic.cpp
37b1e98f5e9d87dfb18edde4b5a11b5dea716b7d
1 // Copyright Louis Dionne 2013-2016
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/div.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/ext/std/ratio.hpp>
9 #include <boost/hana/minus.hpp>
10 #include <boost/hana/mod.hpp>
11 #include <boost/hana/mult.hpp>
12 #include <boost/hana/one.hpp>
13 #include <boost/hana/plus.hpp>
14 #include <boost/hana/zero.hpp>
17 namespace hana
= boost::hana
;
20 BOOST_HANA_CONSTANT_CHECK(hana::equal(
21 hana::plus(std::ratio
<5, 3>{}, std::ratio
<3, 12>{}),
25 BOOST_HANA_CONSTANT_CHECK(hana::equal(
26 hana::minus(std::ratio
<5, 3>{}, std::ratio
<3, 13>{}),
30 BOOST_HANA_CONSTANT_CHECK(hana::equal(
31 hana::mult(std::ratio
<5, 3>{}, std::ratio
<3, 13>{}),
35 BOOST_HANA_CONSTANT_CHECK(hana::equal(
36 hana::div(std::ratio
<5, 3>{}, std::ratio
<3, 13>{}),
40 // The mod of two ratios is always 0, because they can always be
41 // divided without remainder.
42 BOOST_HANA_CONSTANT_CHECK(hana::equal(
43 hana::mod(std::ratio
<5, 3>{}, std::ratio
<3, 13>{}),
47 BOOST_HANA_CONSTANT_CHECK(hana::equal(
48 hana::zero
<hana::ext::std::ratio_tag
>(),
52 BOOST_HANA_CONSTANT_CHECK(hana::equal(
53 hana::one
<hana::ext::std::ratio_tag
>(),