This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

3036. polymorphic_allocator::destroy is extraneous

Section: 19.12.3 [mem.poly.allocator.class] Status: New Submitter: Casey Carter Opened: 2017-11-15 Last modified: 2017-11-29

Priority: 3

View other active issues in [mem.poly.allocator.class].

View all other issues in [mem.poly.allocator.class].

View all issues with New status.


polymorphic_allocator's member function destroy is exactly equivalent to the default implementation of destroy in allocator_traits ( [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.

Proposed resolution:

Wording relative to N4700.

  1. Strike the declaration of destroy from the synopsis of class polymorphic_allocator in 19.12.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;
  2. Strike the specification of destroy in [mem.poly.allocator.mem]:

    template <class T>
      void destroy(T* p);

    14 Effects: As if by p->~T().