| 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/equal.hpp> |
| 7 | #include <boost/hana/if.hpp> |
| 8 | #include <boost/hana/integral_constant.hpp> |
| 9 | #include <boost/hana/minus.hpp> |
| 10 | #include <boost/hana/optional.hpp> |
| 11 | #include <boost/hana/pair.hpp> |
| 12 | #include <boost/hana/tuple.hpp> |
| 13 | #include <boost/hana/unfold_left.hpp> |
| 14 | namespace hana = boost::hana; |
| 15 | |
| 16 | |
| 17 | BOOST_HANA_CONSTANT_CHECK( |
| 18 | hana::unfold_left<hana::tuple_tag>(hana::int_c<10>, [](auto x) { |
| 19 | return hana::if_(x == hana::int_c<0>, |
| 20 | hana::nothing, |
| 21 | hana::just(hana::make_pair(x - hana::int_c<1>, x)) |
| 22 | ); |
| 23 | }) |
| 24 | == |
| 25 | hana::tuple_c<int, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10> |
| 26 | ); |
| 27 | |
| 28 | int main() { } |
| 29 | |