2065. Minimal allocator interface

Section: 16.4.4.6 [allocator.requirements] Status: C++14 Submitter: Jonathan Wakely Opened: 2011-06-06 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [allocator.requirements].

View all other issues in [allocator.requirements].

View all issues with C++14 status.

Discussion:

The example in 16.4.4.6 [allocator.requirements] says SimpleAllocator satisfies the requirements of Table 28 — Allocator requirements, but it doesn't support comparison for equality/inequality.

[Bloomington, 2011]

Move to Ready

Proposed resolution:

This wording is relative to the FDIS.

  1. Modify the example in 16.4.4.6 [allocator.requirements] p5 as indicated:

    -5- […]

    [ Example: the following is an allocator class template supporting the minimal interface that satisfies the requirements of Table 28:

    template <class Tp>
    struct SimpleAllocator {
      typedef Tp value_type;
      SimpleAllocator(ctor args);
      template <class T> SimpleAllocator(const SimpleAllocator<T>& other);
      Tp *allocate(std::size_t n);
      void deallocate(Tp *p, std::size_t n);
    };
    
    template <class T, class U>
    bool operator==(const SimpleAllocator<T>&, const SimpleAllocator<U>&);
    template <class T, class U>
    bool operator!=(const SimpleAllocator<T>&, const SimpleAllocator<U>&);
    

    end example ]