diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index a7547b55..47509962 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -187,6 +187,11 @@ namespace boost { { } + concurrent_flat_map(concurrent_flat_map const& rhs, allocator_type a) + : table_(rhs.table_, a) + { + } + /// Capacity /// diff --git a/test/cfoa/constructor_tests.cpp b/test/cfoa/constructor_tests.cpp index e47cf1c1..2d4fa8fd 100644 --- a/test/cfoa/constructor_tests.cpp +++ b/test/cfoa/constructor_tests.cpp @@ -212,6 +212,7 @@ namespace { auto values = make_random_values(1024 * 16, [&] { return gen(rg); }); auto reference_map = boost::unordered_flat_map(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 > 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