]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/optional/searchable.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / 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)
4
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;
14
15
16 auto odd = [](auto x) {
17 return x % hana::int_c<2> != hana::int_c<0>;
18 };
19
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);
23
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));
26
27 int main() { }