]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/partition.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/ext/std/integral_constant.hpp>
8 #include <boost/hana/integral_constant.hpp>
9 #include <boost/hana/mod.hpp>
10 #include <boost/hana/not_equal.hpp>
11 #include <boost/hana/pair.hpp>
12 #include <boost/hana/partition.hpp>
13 #include <boost/hana/tuple.hpp>
14 #include <boost/hana/type.hpp>
16 #include <type_traits>
17 namespace hana
= boost::hana
;
20 BOOST_HANA_CONSTANT_CHECK(
21 hana::partition(hana::tuple_c
<int, 1, 2, 3, 4, 5, 6, 7>, [](auto x
) {
22 return x
% hana::int_c
<2> != hana::int_c
<0>;
26 hana::tuple_c
<int, 1, 3, 5, 7>,
27 hana::tuple_c
<int, 2, 4, 6>
31 BOOST_HANA_CONSTANT_CHECK(
32 hana::partition(hana::tuple_t
<void, int, float, char, double>, hana::trait
<std::is_floating_point
>)
35 hana::tuple_t
<float, double>,
36 hana::tuple_t
<void, int, char>
41 // partition.by is syntactic sugar
42 BOOST_HANA_CONSTANT_CHECK(
43 hana::partition
.by(hana::trait
<std::is_floating_point
>,
44 hana::tuple_t
<void, int, float, char, double>)
47 hana::tuple_t
<float, double>,
48 hana::tuple_t
<void, int, char>