]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/comparing.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / comparing.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)
4
5 #include <boost/hana/comparing.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/group.hpp>
8 #include <boost/hana/length.hpp>
9 #include <boost/hana/range.hpp>
10 #include <boost/hana/tuple.hpp>
11 namespace hana = boost::hana;
12
13
14 int main() {
15 constexpr auto sequences = hana::make_tuple(
16 hana::make_tuple(1, 2, 3),
17 hana::make_tuple('x', 'y', 'z'),
18 hana::range_c<long, 0, 1>,
19 hana::tuple_t<char, int>,
20 hana::range_c<int, 0, 2>,
21 hana::make_tuple(123.4, nullptr)
22 );
23
24 constexpr auto grouped = hana::group.by(hana::comparing(hana::length), sequences);
25
26 static_assert(grouped == hana::make_tuple(
27 hana::make_tuple(
28 hana::make_tuple(1, 2, 3),
29 hana::make_tuple('x', 'y', 'z')
30 ),
31 hana::make_tuple(
32 hana::range_c<long, 0, 1>
33 ),
34 hana::make_tuple(
35 hana::tuple_t<char, int>,
36 hana::range_c<int, 0, 2>,
37 hana::make_tuple(123.4, nullptr)
38 )
39 ), "");
40 }