mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
Add explicit allocator constructor
This commit is contained in:
@ -182,6 +182,11 @@ namespace boost {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explicit concurrent_flat_map(allocator_type a)
|
||||||
|
: table_(detail::foa::default_bucket_count, hasher(), key_equal(), a)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// Capacity
|
/// Capacity
|
||||||
///
|
///
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ namespace {
|
|||||||
map_type x(values.begin(), values.end(), 0, hasher(1), key_equal(2),
|
map_type x(values.begin(), values.end(), 0, hasher(1), key_equal(2),
|
||||||
allocator_type{});
|
allocator_type{});
|
||||||
|
|
||||||
std::atomic_int num_transfers{0};
|
std::atomic_uint num_transfers{0};
|
||||||
|
|
||||||
thread_runner(
|
thread_runner(
|
||||||
values, [&x, &reference_map, &num_transfers](
|
values, [&x, &reference_map, &num_transfers](
|
||||||
@ -429,6 +429,21 @@ namespace {
|
|||||||
check_raii_counts();
|
check_raii_counts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UNORDERED_AUTO_TEST (explicit_allocator) {
|
||||||
|
raii::reset_counts();
|
||||||
|
|
||||||
|
{
|
||||||
|
allocator_type a;
|
||||||
|
map_type x(a);
|
||||||
|
|
||||||
|
BOOST_TEST_EQ(x.size(), 0u);
|
||||||
|
BOOST_TEST_EQ(x.hash_function(), hasher());
|
||||||
|
BOOST_TEST_EQ(x.key_eq(), key_equal());
|
||||||
|
|
||||||
|
BOOST_TEST(x.get_allocator() == a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
Reference in New Issue
Block a user