]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/iterable/searchable.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)
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/ext/std/integral_constant.hpp>
7 #include <boost/hana/find.hpp>
8 #include <boost/hana/find_if.hpp>
9 #include <boost/hana/functional/compose.hpp>
10 #include <boost/hana/integral_constant.hpp>
11 #include <boost/hana/optional.hpp>
12 #include <boost/hana/tuple.hpp>
13 #include <boost/hana/type.hpp>
15 #include <type_traits>
16 namespace hana
= boost::hana
;
19 // First get the type of the object, and then call the trait on it.
20 constexpr auto is_integral
= hana::compose(hana::trait
<std::is_integral
>, hana::typeid_
);
21 constexpr auto is_class
= hana::compose(hana::trait
<std::is_class
>, hana::typeid_
);
24 hana::find_if(hana::make_tuple(1.0, 2, '3'), is_integral
)
29 BOOST_HANA_CONSTANT_CHECK(
30 hana::find_if(hana::make_tuple(1.0, 2, '3'), is_class
)
35 BOOST_HANA_CONSTANT_CHECK(
36 hana::find(hana::make_tuple(hana::int_c
<1>, hana::char_c
<'c'>, hana::type_c
<void>), hana::type_c
<void>)
38 hana::just(hana::type_c
<void>)
41 BOOST_HANA_CONSTANT_CHECK(
42 hana::find(hana::make_tuple(hana::int_c
<1>, hana::char_c
<'c'>, hana::type_c
<void>), hana::type_c
<int>)