[mem.res.class.general]

# 20 Memory management library [[mem]](./#mem)

## 20.5 Memory resources [[mem.res]](mem.res#class.general)

### 20.5.2 Class memory_resource [[mem.res.class]](mem.res.class#general)

#### 20.5.2.1 General [mem.res.class.general]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/memory.tex#L7484)

The memory_resource class is an abstract interface to an unbounded set of classes encapsulating memory resources[.](#1.sentence-1)

[ð](#lib:memory_resource)

namespace std::pmr {class memory_resource {static constexpr size_t max_align = alignof(max_align_t); // *exposition only*public: memory_resource() = default;
 memory_resource(const memory_resource&) = default; virtual ~memory_resource();

 memory_resource& operator=(const memory_resource&) = default; void* allocate(size_t bytes, size_t alignment = max_align); void deallocate(void* p, size_t bytes, size_t alignment = max_align); bool is_equal(const memory_resource& other) const noexcept; private: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; };}
