]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/at_key.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/at_key.hpp>
7 #include <boost/hana/equal.hpp>
8 #include <boost/hana/map.hpp>
10 #include <laws/base.hpp>
11 #include <support/minimal_product.hpp>
14 namespace hana
= boost::hana
;
18 auto key() { return hana::test::ct_eq
<i
>{}; }
21 auto val() { return hana::test::ct_eq
<-i
>{}; }
23 template <int i
, int j
>
24 auto p() { return ::minimal_product(key
<i
>(), val
<j
>()); }
27 BOOST_HANA_CONSTANT_CHECK(hana::equal(
28 hana::at_key(hana::make_map(p
<0, 0>()), key
<0>()),
32 BOOST_HANA_CONSTANT_CHECK(hana::equal(
33 hana::at_key(hana::make_map(p
<0, 0>(), p
<1,1>()), key
<0>()),
36 BOOST_HANA_CONSTANT_CHECK(hana::equal(
37 hana::at_key(hana::make_map(p
<0, 0>(), p
<1,1>()), key
<1>()),
41 BOOST_HANA_CONSTANT_CHECK(hana::equal(
42 hana::at_key(hana::make_map(p
<0, 0>(), p
<1,1>(), p
<2,2>()), key
<0>()),
45 BOOST_HANA_CONSTANT_CHECK(hana::equal(
46 hana::at_key(hana::make_map(p
<0, 0>(), p
<1,1>(), p
<2,2>()), key
<1>()),
49 BOOST_HANA_CONSTANT_CHECK(hana::equal(
50 hana::at_key(hana::make_map(p
<0, 0>(), p
<1,1>(), p
<2,2>()), key
<2>()),
55 auto m
= hana::make_map(p
<2, 2>(), p
<1, 1>());
56 auto const const_m
= hana::make_map(p
<2, 2>(), p
<1, 1>());
57 BOOST_HANA_CONSTANT_CHECK(hana::equal(m
[key
<1>()], val
<1>()));
58 BOOST_HANA_CONSTANT_CHECK(hana::equal(const_m
[key
<1>()], val
<1>()));
59 BOOST_HANA_CONSTANT_CHECK(hana::equal(std::move(m
)[key
<1>()], val
<1>()));