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