]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/set/find_if.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / test / set / find_if.cpp
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/at_key.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/find_if.hpp>
9 #include <boost/hana/optional.hpp>
10 #include <boost/hana/set.hpp>
11
12 #include <laws/base.hpp>
13 namespace hana = boost::hana;
14 using hana::test::ct_eq;
15
16
17 int main() {
18 BOOST_HANA_CONSTANT_CHECK(hana::equal(
19 hana::find_if(hana::make_set(), hana::equal.to(ct_eq<1>{})),
20 hana::nothing
21 ));
22
23 BOOST_HANA_CONSTANT_CHECK(hana::equal(
24 hana::find_if(hana::make_set(ct_eq<1>{}), hana::equal.to(ct_eq<1>{})),
25 hana::just(ct_eq<1>{})
26 ));
27 BOOST_HANA_CONSTANT_CHECK(hana::equal(
28 hana::find_if(hana::make_set(ct_eq<1>{}), hana::equal.to(ct_eq<2>{})),
29 hana::nothing
30 ));
31
32 BOOST_HANA_CONSTANT_CHECK(hana::equal(
33 hana::find_if(hana::make_set(ct_eq<1>{}, ct_eq<2>{}), hana::equal.to(ct_eq<1>{})),
34 hana::just(ct_eq<1>{})
35 ));
36 BOOST_HANA_CONSTANT_CHECK(hana::equal(
37 hana::find_if(hana::make_set(ct_eq<1>{}, ct_eq<2>{}), hana::equal.to(ct_eq<2>{})),
38 hana::just(ct_eq<2>{})
39 ));
40 BOOST_HANA_CONSTANT_CHECK(hana::equal(
41 hana::find_if(hana::make_set(ct_eq<1>{}, ct_eq<2>{}), hana::equal.to(ct_eq<3>{})),
42 hana::nothing
43 ));
44
45 // find with operators
46 BOOST_HANA_CONSTANT_CHECK(hana::equal(
47 hana::make_set(ct_eq<1>{})[ct_eq<1>{}],
48 ct_eq<1>{}
49 ));
50 }