]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/unfold_left.cpp
1 // Copyright Louis Dionne 2013-2017
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/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
;
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>,
21 hana::just(hana::make_pair(x
- hana::int_c
<1>, x
))
25 hana::tuple_c
<int, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10>