]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/concept/struct/find_if.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / concept / struct / find_if.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)
4
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/concept/struct.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/find_if.hpp>
9 #include <boost/hana/integral_constant.hpp>
10 #include <boost/hana/optional.hpp>
11
12 #include "minimal_struct.hpp"
13 #include <laws/base.hpp>
14 namespace hana = boost::hana;
15 using hana::test::ct_eq;
16
17
18 template <int i = 0>
19 struct undefined { };
20
21 int main() {
22 BOOST_HANA_CONSTANT_CHECK(hana::equal(
23 hana::find_if(obj(), undefined<>{}),
24 hana::nothing
25 ));
26
27 BOOST_HANA_CONSTANT_CHECK(hana::equal(
28 hana::find_if(obj(ct_eq<0>{}), hana::equal.to(hana::int_c<0>)),
29 hana::just(ct_eq<0>{})
30 ));
31 BOOST_HANA_CONSTANT_CHECK(hana::equal(
32 hana::find_if(obj(undefined<1>{}), hana::equal.to(hana::int_c<1>)),
33 hana::nothing
34 ));
35
36 BOOST_HANA_CONSTANT_CHECK(hana::equal(
37 hana::find_if(obj(ct_eq<0>{}, ct_eq<1>{}), hana::equal.to(hana::int_c<0>)),
38 hana::just(ct_eq<0>{})
39 ));
40 BOOST_HANA_CONSTANT_CHECK(hana::equal(
41 hana::find_if(obj(ct_eq<0>{}, ct_eq<1>{}), hana::equal.to(hana::int_c<1>)),
42 hana::just(ct_eq<1>{})
43 ));
44 BOOST_HANA_CONSTANT_CHECK(hana::equal(
45 hana::find_if(obj(undefined<0>{}, undefined<1>{}), hana::equal.to(hana::int_c<2>)),
46 hana::nothing
47 ));
48 }