]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/span.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / span.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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/integral_constant.hpp>
8#include <boost/hana/less.hpp>
9#include <boost/hana/pair.hpp>
10#include <boost/hana/span.hpp>
11#include <boost/hana/tuple.hpp>
12namespace hana = boost::hana;
13
14
15constexpr auto xs = hana::make_tuple(hana::int_c<1>, hana::int_c<2>, hana::int_c<3>, hana::int_c<4>);
16
17BOOST_HANA_CONSTANT_CHECK(
18 hana::span(xs, hana::less.than(hana::int_c<3>))
19 ==
20 hana::make_pair(hana::make_tuple(hana::int_c<1>, hana::int_c<2>),
21 hana::make_tuple(hana::int_c<3>, hana::int_c<4>))
22);
23
24BOOST_HANA_CONSTANT_CHECK(
25 hana::span(xs, hana::less.than(hana::int_c<0>))
26 ==
27 hana::make_pair(hana::make_tuple(), xs)
28);
29
30BOOST_HANA_CONSTANT_CHECK(
31 hana::span(xs, hana::less.than(hana::int_c<5>))
32 ==
33 hana::make_pair(xs, hana::make_tuple())
34);
35
36// span.by is syntactic sugar
37BOOST_HANA_CONSTANT_CHECK(
38 hana::span.by(hana::less.than(hana::int_c<3>), xs)
39 ==
40 hana::make_pair(hana::make_tuple(hana::int_c<1>, hana::int_c<2>),
41 hana::make_tuple(hana::int_c<3>, hana::int_c<4>))
42);
43
44int main() { }