Add allocator-aware copy constructor

This commit is contained in:
Christian Mazakas
2023-04-19 09:35:38 -07:00
parent fb403bc233
commit 37edc392a5
2 changed files with 30 additions and 0 deletions

View File

@ -187,6 +187,11 @@ namespace boost {
{
}
concurrent_flat_map(concurrent_flat_map const& rhs, allocator_type a)
: table_(rhs.table_, a)
{
}
/// Capacity
///

View File

@ -212,6 +212,7 @@ namespace {
auto values = make_random_values(1024 * 16, [&] { return gen(rg); });
auto reference_map =
boost::unordered_flat_map<raii, raii>(values.begin(), values.end());
raii::reset_counts();
{
@ -234,6 +235,30 @@ namespace {
}
check_raii_counts();
raii::reset_counts();
{
allocator_type a;
map_type x(values.begin(), values.end(), 0, hasher(1), key_equal(2), a);
thread_runner(
values, [&x, &reference_map, a](
boost::span<span_value_type<decltype(values)> > s) {
(void)s;
map_type y(x, a);
test_matches_reference(x, reference_map);
test_matches_reference(y, reference_map);
BOOST_TEST_EQ(y.size(), x.size());
BOOST_TEST_EQ(y.hash_function(), x.hash_function());
BOOST_TEST_EQ(y.key_eq(), x.key_eq());
BOOST_TEST(y.get_allocator() == x.get_allocator());
});
}
check_raii_counts();
}
template <class G>