During the last two weeks, first we saw what are the language features deprecated or removed from C++26 then we did the same for library features. Life is not so straight and easy though. Sometimes, features cannot be removed after deprecation. There is an example for that in C++26 too. Which we are going to review today.
Undeprecate polymorphic_allocator::destroy
for C++26
C++23 deprecated the std::polymorphic_allocator::destroy
member function and instead of having it removed, it’s being added back to C++26 by P2875R4.
The short reason for the deprecation and a hoped removal was that the purposes of std::polymorphic_allocator::destroy
are satisfied by std::allocator_traits
too. But it turned out in practice, that some use-cases of polymorphic_allocator::destroy
don’t involve generic code that would use std::allocator_traits
.
But reading through the proposal unveils a more complex and interesting story. To understand what happened, we must travel back in time almost ten years.
There was already an issue filed for C