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/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>
17 namespace hana = boost::hana;
18 
19 
20 BOOST_HANA_CONSTANT_CHECK(
__anonb91a5ef90102(auto x) 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 
31 BOOST_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
42 BOOST_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 
main()52 int main() { }
53