]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/map/assign.copy.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / map / assign.copy.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)
4
5 #include <boost/hana/assert.hpp>
6 #include <boost/hana/at_key.hpp>
7 #include <boost/hana/map.hpp>
8 #include <boost/hana/pair.hpp>
9
10 #include <laws/base.hpp>
11
12 #include <string>
13 namespace hana = boost::hana;
14 namespace test = hana::test;
15
16
17 int main() {
18 {
19 using Map = hana::map<>;
20 Map map0;
21 Map map;
22 map0 = map;
23 }
24 {
25 using Map = hana::map<hana::pair<test::ct_eq<0>, int>>;
26 Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 999));
27 Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 4));
28 map0 = map;
29 BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == 4);
30 }
31 {
32 using Map = hana::map<hana::pair<test::ct_eq<0>, int>,
33 hana::pair<test::ct_eq<1>, char>>;
34 Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 999),
35 hana::make_pair(test::ct_eq<1>{}, 'z'));
36 Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 4),
37 hana::make_pair(test::ct_eq<1>{}, 'a'));
38 map0 = map;
39 BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == 4);
40 BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == 'a');
41 }
42 {
43 using Map = hana::map<hana::pair<test::ct_eq<0>, int>,
44 hana::pair<test::ct_eq<1>, char>,
45 hana::pair<test::ct_eq<2>, std::string>>;
46 Map map0 = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 999),
47 hana::make_pair(test::ct_eq<1>{}, 'z'),
48 hana::make_pair(test::ct_eq<2>{}, std::string{"zzzzzzzz"}));
49 Map map = hana::make_map(hana::make_pair(test::ct_eq<0>{}, 4),
50 hana::make_pair(test::ct_eq<1>{}, 'a'),
51 hana::make_pair(test::ct_eq<2>{}, std::string{"abc"}));
52 map0 = map;
53 BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<0>{}) == 4);
54 BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<1>{}) == 'a');
55 BOOST_HANA_RUNTIME_CHECK(hana::at_key(map0, test::ct_eq<2>{}) == "abc");
56 }
57 }