]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/example/map/searchable.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / example / map / searchable.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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/at_key.hpp>
7#include <boost/hana/equal.hpp>
8#include <boost/hana/find.hpp>
9#include <boost/hana/integral_constant.hpp>
10#include <boost/hana/map.hpp>
11#include <boost/hana/optional.hpp>
12#include <boost/hana/pair.hpp>
13#include <boost/hana/type.hpp>
14namespace hana = boost::hana;
15
16
17constexpr auto m = hana::make_map(
18 hana::make_pair(hana::type_c<int>, 'i'),
19 hana::make_pair(hana::type_c<float>, 'f')
20);
21static_assert(hana::find(m, hana::type_c<int>) == hana::just('i'), "");
22static_assert(hana::find(m, hana::type_c<float>) == hana::just('f'), "");
23BOOST_HANA_CONSTANT_CHECK(hana::find(m, hana::type_c<void>) == hana::nothing);
24BOOST_HANA_CONSTANT_CHECK(hana::find(m, hana::int_c<3>) == hana::nothing);
25
26// operator[] is equivalent to at_key
27static_assert(m[hana::type_c<int>] == 'i', "");
28static_assert(m[hana::type_c<float>] == 'f', "");
29
30int main() { }