Skip to content
Commit 39c87951 authored by Marshall Clow's avatar Marshall Clow Committed by Louis Dionne
Browse files

[libc++] Use allocator_traits to consistently...

[libc++] Use allocator_traits to consistently allocate/deallocate/construct/destroy objects in std::any

https://llvm.org/PR45099 notes (correctly) that we're inconsistent in memory
allocation in `std::any`. We allocate memory with `std::allocator<T>::allocate`,
construct with placement new, destroy by calling the destructor directly, and
deallocate by calling `delete`. Most of those are customizable by the user,
but in different ways.

The standard is silent on how these things are to be accomplished.
This patch makes it so we use `allocator_traits<allocator<T>>` for all
of these operations (allocate, construct, destruct, deallocate).
This is, at least, consistent.

Fixes https://llvm.org/PR45099.

Differential Revision: https://reviews.llvm.org/D81133
parent 89857557
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment