]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/optional/searchable.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)
5 #include <boost/hana/all_of.hpp>
6 #include <boost/hana/assert.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/mod.hpp>
11 #include <boost/hana/not_equal.hpp>
12 #include <boost/hana/optional.hpp>
13 namespace hana
= boost::hana
;
16 auto odd
= [](auto x
) {
17 return x
% hana::int_c
<2> != hana::int_c
<0>;
20 BOOST_HANA_CONSTANT_CHECK(hana::find_if(hana::just(hana::int_c
<3>), odd
) == hana::just(hana::int_c
<3>));
21 BOOST_HANA_CONSTANT_CHECK(hana::find_if(hana::just(hana::int_c
<2>), odd
) == hana::nothing
);
22 BOOST_HANA_CONSTANT_CHECK(hana::find_if(hana::nothing
, odd
) == hana::nothing
);
24 BOOST_HANA_CONSTANT_CHECK(hana::all_of(hana::just(hana::int_c
<3>), odd
));
25 BOOST_HANA_CONSTANT_CHECK(hana::all_of(hana::nothing
, odd
));