]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/find.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / example / find.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/equal.hpp>
7 #include <boost/hana/find.hpp>
8 #include <boost/hana/integral_constant.hpp>
9 #include <boost/hana/map.hpp>
10 #include <boost/hana/optional.hpp>
11 #include <boost/hana/pair.hpp>
12 #include <boost/hana/tuple.hpp>
13 #include <boost/hana/type.hpp>
14 namespace hana = boost::hana;
15
16
17 BOOST_HANA_CONSTANT_CHECK(
18 hana::find(hana::make_tuple(hana::int_c<1>, hana::type_c<int>, '3'), hana::type_c<int>) == hana::just(hana::type_c<int>)
19 );
20 BOOST_HANA_CONSTANT_CHECK(
21 hana::find(hana::make_tuple(hana::int_c<1>, hana::type_c<int>, '3'), hana::type_c<void>) == hana::nothing
22 );
23
24 constexpr auto m = hana::make_map(
25 hana::make_pair(hana::int_c<2>, 2),
26 hana::make_pair(hana::type_c<float>, 3.3),
27 hana::make_pair(hana::type_c<char>, hana::type_c<int>)
28 );
29 static_assert(hana::find(m, hana::type_c<float>) == hana::just(3.3), "");
30
31 int main() { }