| 1 | // Copyright Louis Dionne 2013-2022 |
|---|---|
| 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) |
| 4 | |
| 5 | #include <boost/hana/assert.hpp> |
| 6 | #include <boost/hana/config.hpp> |
| 7 | #include <boost/hana/equal.hpp> |
| 8 | #include <boost/hana/functional/infix.hpp> |
| 9 | #include <boost/hana/pair.hpp> |
| 10 | namespace hana = boost::hana; |
| 11 | |
| 12 | |
| 13 | BOOST_HANA_CONSTEXPR_LAMBDA auto divmod = hana::infix([](auto x, auto y) { |
| 14 | // this could be a more efficient implementation |
| 15 | return hana::make_pair(x / y, x % y); |
| 16 | }); |
| 17 | |
| 18 | int main() { |
| 19 | BOOST_HANA_CONSTEXPR_CHECK((42 ^divmod^ 23) == hana::make_pair(1, 19)); |
| 20 | } |
| 21 |
