]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/container/container_tests10a.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / phoenix / test / container / container_tests10a.cpp
1 /*=============================================================================
2 Copyright (c) 2004 Angus Leeming
3 Copyright (c) 2017 Kohei Takahashi
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #include "container_tests.hpp"
9 #include <boost/static_assert.hpp>
10
11 std::unordered_map<int, int> const build_unordered_map()
12 {
13 typedef std::unordered_map<int, int> int_map;
14 typedef std::vector<int> int_vector;
15
16 int_map result;
17 int_vector const data = build_vector();
18 int_vector::const_iterator it = data.begin();
19 int_vector::const_iterator const end = data.end();
20 for (; it != end; ++it) {
21 int const value = *it;
22 result[value] = 100 * value;
23 }
24 return result;
25 }
26
27 std::unordered_multimap<int, int> const build_unordered_multimap()
28 {
29 typedef std::unordered_map<int, int> int_map;
30 typedef std::unordered_multimap<int, int> int_multimap;
31 int_map const data = build_unordered_map();
32 return int_multimap(data.begin(), data.end());
33 }
34
35 std::vector<int> const init_vector()
36 {
37 typedef std::vector<int> int_vector;
38 int const data[] = { -4, -3, -2, -1, 0 };
39 int_vector::size_type const data_size = sizeof(data) / sizeof(data[0]);
40 return int_vector(data, data + data_size);
41 }
42
43 std::vector<int> const build_vector()
44 {
45 typedef std::vector<int> int_vector;
46 static int_vector data = init_vector();
47 int_vector::size_type const size = data.size();
48 int_vector::iterator it = data.begin();
49 int_vector::iterator const end = data.end();
50 for (; it != end; ++it)
51 *it += size;
52 return data;
53 }
54
55 int
56 main()
57 {
58 BOOST_STATIC_ASSERT((phx::stl::has_mapped_type<std::unordered_multimap<int, int> >::value));
59 BOOST_STATIC_ASSERT((phx::stl::has_key_type<std::unordered_multimap<int, int> >::value));
60
61 std::unordered_multimap<int, int> const data = build_unordered_multimap();
62 test_begin(data);
63 test_clear(data);
64 test_empty(data);
65 test_end(data);
66 test_map_erase(data);
67 test_get_allocator(data);
68 return boost::report_errors();
69 }
70
71
72
73