Fix fca allocator swapping, and test that pmr allocator swap compiles

This commit is contained in:
Braden Ganetsky
2024-03-24 12:22:45 -05:00
parent e816ba511c
commit e63853d87d
2 changed files with 27 additions and 7 deletions
+22 -6
View File
@@ -659,12 +659,7 @@ namespace boost {
std::swap(buckets, other.buckets);
std::swap(groups, other.groups);
bool b = boost::allocator_propagate_on_container_swap<
allocator_type>::type::value;
if (b) {
boost::core::invoke_swap(
get_node_allocator(), other.get_node_allocator());
}
swap_allocator_if_pocs(other);
}
node_allocator_type const& get_node_allocator() const
@@ -876,6 +871,27 @@ namespace boost {
pbg->prev->next = pbg->next;
pbg->prev = pbg->next = group_pointer();
}
void swap_allocator_if_pocs(grouped_bucket_array& other)
{
using allocator_pocs =
typename boost::allocator_propagate_on_container_swap<
allocator_type>::type;
swap_allocator_if_pocs(
other, std::integral_constant<bool, allocator_pocs::value>());
}
void swap_allocator_if_pocs(
grouped_bucket_array& other, std::true_type /* propagate */)
{
boost::core::invoke_swap(
get_node_allocator(), other.get_node_allocator());
}
void swap_allocator_if_pocs(
grouped_bucket_array&, std::false_type /* don't propagate */)
{
}
};
} // namespace detail
} // namespace unordered