tmp/tmpmqx7cgqf/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### `memory_resource` private virtual member functions <a id="mem.res.private">[[mem.res.private]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
virtual void* do_allocate(size_t bytes, size_t alignment) = 0;
|
| 5 |
+
```
|
| 6 |
+
|
| 7 |
+
*Requires:* `alignment` shall be a power of two.
|
| 8 |
+
|
| 9 |
+
*Returns:* A derived class shall implement this function to return a
|
| 10 |
+
pointer to allocated storage ([[basic.stc.dynamic.deallocation]]) with
|
| 11 |
+
a size of at least `bytes`. The returned storage is aligned to the
|
| 12 |
+
specified alignment, if such alignment is supported ([[basic.align]]);
|
| 13 |
+
otherwise it is aligned to `max_align`.
|
| 14 |
+
|
| 15 |
+
*Throws:* A derived class implementation shall throw an appropriate
|
| 16 |
+
exception if it is unable to allocate memory with the requested size and
|
| 17 |
+
alignment.
|
| 18 |
+
|
| 19 |
+
``` cpp
|
| 20 |
+
virtual void do_deallocate(void* p, size_t bytes, size_t alignment) = 0;
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
*Requires:* `p` shall have been returned from a prior call to
|
| 24 |
+
`allocate(bytes, alignment)` on a memory resource equal to `*this`, and
|
| 25 |
+
the storage at `p` shall not yet have been deallocated.
|
| 26 |
+
|
| 27 |
+
*Effects:* A derived class shall implement this function to dispose of
|
| 28 |
+
allocated storage.
|
| 29 |
+
|
| 30 |
+
*Throws:* Nothing.
|
| 31 |
+
|
| 32 |
+
``` cpp
|
| 33 |
+
virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
*Returns:* A derived class shall implement this function to return
|
| 37 |
+
`true` if memory allocated from `this` can be deallocated from `other`
|
| 38 |
+
and vice-versa, otherwise `false`.
|
| 39 |
+
|
| 40 |
+
[*Note 1*: The most-derived type of `other` might not match the type of
|
| 41 |
+
`this`. For a derived class `D`, a typical implementation of this
|
| 42 |
+
function will immediately return `false` if
|
| 43 |
+
`dynamic_cast<const D*>(&other) == nullptr`. — *end note*]
|
| 44 |
+
|