A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.
Document number: N3974
by Marco Arena, Davide di Gennaro and Peter Sommerlad
... However, with heap-allocated polymorphic types in C++11 code this means one needs to use
make_shared<Derived>to avoid the need to define a virtual destructor for
Base. There is no standard deleter for
unique_ptrthat will allow to safely use
Basedoesn't define a virtual destructor. Such a misuse is not even detectable easily. However, always using
shared_ptrto get its desired deleter magic would also incur the overhead of the atomic reference counter and the overhead of full type erasure.
This proposal tries to ease the burden for programmers of heap allocated polymorphic classes and gives them the option to use
unique_ptrwith a standard provided deleter classes that either check correct provisioning of a virtual destructor in the base class or provide a slight overhead infrastructure for safe deletes through base type pointers, even if the base class doesn't define a virtual destructor.