]>
git.proxmox.com Git - ceph.git/blob - 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)
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
;
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)
24 constexpr auto grouped
= hana::group
.by(hana::comparing(hana::length
), sequences
);
26 static_assert(grouped
== hana::make_tuple(
28 hana::make_tuple(1, 2, 3),
29 hana::make_tuple('x', 'y', 'z')
32 hana::range_c
<long, 0, 1>
35 hana::tuple_t
<char, int>,
36 hana::range_c
<int, 0, 2>,
37 hana::make_tuple(123.4, nullptr)