polymorphic_allocator::destroy
is extraneousSection: 20.4.3 [mem.poly.allocator.class] Status: C++23 Submitter: Casey Carter Opened: 2017-11-15 Last modified: 2023-11-22
Priority: 3
View all other issues in [mem.poly.allocator.class].
View all issues with C++23 status.
Discussion:
polymorphic_allocator
's member function destroy
is exactly
equivalent to the default implementation of destroy
in
allocator_traits
(20.2.9.3 [allocator.traits.members] para 6). It
should be struck from polymorphic_allocator
as it provides no value.
[28-Nov-2017 Mailing list discussion - set priority to P3]
PJ says that Dinkumware is shipping an implementation of polymorphic_allocator
with destroy
, so removing it would be a breaking change for him.
[2019-02; Kona Wednesday night issue processing]
Status to Open; revisit once P0339 lands. Poll taken was 5-3-2 in favor of removal.
[2020-10-05; Jonathan provides new wording]
Previous resolution [SUPERSEDED]:
Wording relative to N4700.
Strike the declaration of
destroy
from the synopsis of classpolymorphic_allocator
in 20.4.3 [mem.poly.allocator.class]:template <class T1, class T2, class U, class V> void construct(pair<T1,T2>* p, pair<U, V>&& pr);template <class T>void destroy(T* p);polymorphic_allocator select_on_container_copy_construction() const;Strike the specification of
destroy
in 20.4.3.3 [mem.poly.allocator.mem]:[…]template <class T>void destroy(T* p);[…]
14 Effects: As if byp->~T()
.
[2020-10-11; Reflector poll]
Moved to Tentatively Ready after seven votes in favour.
[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]
Proposed resolution:
Wording relative to N4861.
Strike the declaration of destroy
from the synopsis of class
polymorphic_allocator
in 20.4.3 [mem.poly.allocator.class]:
template <class T1, class T2, class U, class V> void construct(pair<T1,T2>* p, pair<U, V>&& pr);template <class T>void destroy(T* p);polymorphic_allocator select_on_container_copy_construction() const;
Adjust the specification of delete_object
in 20.4.3.3 [mem.poly.allocator.mem]:
template <class T> void delete_object(T* p);-13- Effects: Equivalent to:
allocator_traits<polymorphic_allocator>::destroy(*this, p); deallocate_object(p);
Strike the specification of destroy
in 20.4.3.3 [mem.poly.allocator.mem]:
[…]template <class T>void destroy(T* p);[…]
-17- Effects: As if byp->~T()
.
Add a new subclause to Annex D:
D.?? Deprecated
polymorphic_allocator
member function-1- The following member is declared in addition to those members specified in 20.4.3.3 [mem.poly.allocator.mem]:
namespace std::pmr { template<class Tp = byte> class polymorphic_allocator { public: template <class T> void destroy(T* p); }; }template <class T> void destroy(T* p);-1- Effects: As if by
p->~T()
.