]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/partition.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / example / partition.cpp
CommitLineData
7c673cae
FG
1// Copyright Louis Dionne 2013-2016
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/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>
15
16#include <type_traits>
17namespace hana = boost::hana;
18
19
20BOOST_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>;
23 })
24 ==
25 hana::make_pair(
26 hana::tuple_c<int, 1, 3, 5, 7>,
27 hana::tuple_c<int, 2, 4, 6>
28 )
29);
30
31BOOST_HANA_CONSTANT_CHECK(
32 hana::partition(hana::tuple_t<void, int, float, char, double>, hana::trait<std::is_floating_point>)
33 ==
34 hana::make_pair(
35 hana::tuple_t<float, double>,
36 hana::tuple_t<void, int, char>
37 )
38);
39
40
41// partition.by is syntactic sugar
42BOOST_HANA_CONSTANT_CHECK(
43 hana::partition.by(hana::trait<std::is_floating_point>,
44 hana::tuple_t<void, int, float, char, double>)
45 ==
46 hana::make_pair(
47 hana::tuple_t<float, double>,
48 hana::tuple_t<void, int, char>
49 )
50);
51
52int main() { }