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

### 2724. The protected virtual member functions of `memory_resource` should be private

Section: 20.12.2 [mem.res.class] Status: C++17 Submitter: Ville Voutilainen Opened: 2016-06-04 Last modified: 2017-07-30

Priority: 4

View all other issues in [mem.res.class].

View all issues with C++17 status.

Discussion:

`memory_resource` doesn't define any behavior, it's just an interface. Furthermore, we don't say whether the functions at [memory.resource.prot] should or should not be defined by implementations. Presumably they should not. Those functions are not designed to be called by derived classes, and thus should not be protected.

[2016-06 Oulu]

Looks fine, check with Pablo to make sure that was his intent.

Pablo replied that this was correct.

Friday: status to Immediate

Proposed resolution:

This wording is relative to N4582.

1. Modify [memory.resource.class] as indicated:

   >     class memory_resource {
   >       […]
   >     protectedprivate:
   >       virtual void* do_allocate(size_t bytes, size_t alignment) = 0;
   >       virtual void do_deallocate(void* p, size_t bytes, size_t alignment) = 0;
   >       virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;
   >     };

2. Modify [memory.resource.prot] as indicated:

   > [Drafting note: I don't know whether it's too late to change the section mnemonic [memory.resource.prot] to e.g. [memory.resource.priv] or perhaps [memory.resource.virt].]

   > `memory_resource` protected private virtual member functions [memory.resource.prot]