tmp/tmpzjazqdu7/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="mem.res.class.general">[[mem.res.class.general]]</a>
|
| 2 |
+
|
| 3 |
+
The `memory_resource` class is an abstract interface to an unbounded set
|
| 4 |
+
of classes encapsulating memory resources.
|
| 5 |
+
|
| 6 |
+
``` cpp
|
| 7 |
+
namespace std::pmr {
|
| 8 |
+
class memory_resource {
|
| 9 |
+
static constexpr size_t max_align = alignof(max_align_t); // exposition only
|
| 10 |
+
|
| 11 |
+
public:
|
| 12 |
+
memory_resource() = default;
|
| 13 |
+
memory_resource(const memory_resource&) = default;
|
| 14 |
+
virtual ~memory_resource();
|
| 15 |
+
|
| 16 |
+
memory_resource& operator=(const memory_resource&) = default;
|
| 17 |
+
|
| 18 |
+
[[nodiscard]] void* allocate(size_t bytes, size_t alignment = max_align);
|
| 19 |
+
void deallocate(void* p, size_t bytes, size_t alignment = max_align);
|
| 20 |
+
|
| 21 |
+
bool is_equal(const memory_resource& other) const noexcept;
|
| 22 |
+
|
| 23 |
+
private:
|
| 24 |
+
virtual void* do_allocate(size_t bytes, size_t alignment) = 0;
|
| 25 |
+
virtual void do_deallocate(void* p, size_t bytes, size_t alignment) = 0;
|
| 26 |
+
|
| 27 |
+
virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;
|
| 28 |
+
};
|
| 29 |
+
}
|
| 30 |
+
```
|
| 31 |
+
|