]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/container/container_tests10a.cpp
1 /*=============================================================================
2 Copyright (c) 2004 Angus Leeming
3 Copyright (c) 2017 Kohei Takahashi
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>
11 std::unordered_map
<int, int> const build_unordered_map()
13 typedef std::unordered_map
<int, int> int_map
;
14 typedef std::vector
<int> int_vector
;
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
;
27 std::unordered_multimap
<int, int> const build_unordered_multimap()
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());
35 std::vector
<int> const init_vector()
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
);
43 std::vector
<int> const build_vector()
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
)
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
));
61 std::unordered_multimap
<int, int> const data
= build_unordered_multimap();
67 test_get_allocator(data
);
68 return boost::report_errors();