tmp/tmpl3wsg709/{from.md → to.md}
RENAMED
|
@@ -9,30 +9,54 @@ call shall happen before the next allocation (if any) in this order.
|
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
[[nodiscard]] constexpr T* allocate(size_t n);
|
| 12 |
```
|
| 13 |
|
| 14 |
-
*Mandates:* `T` is not an incomplete type [[
|
| 15 |
|
| 16 |
*Returns:* A pointer to the initial element of an array of `n` `T`.
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
*Remarks:* The storage for the array is obtained by calling
|
| 19 |
`::operator new` [[new.delete]], but it is unspecified when or how often
|
| 20 |
this function is called. This function starts the lifetime of the array
|
| 21 |
object, but not that of any of the array elements.
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
*Throws:* `bad_array_new_length` if
|
| 24 |
-
`numeric_limits<size_t>::max() / sizeof(T) < n`, or `bad_alloc` if the
|
| 25 |
storage cannot be obtained.
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
``` cpp
|
| 28 |
constexpr void deallocate(T* p, size_t n);
|
| 29 |
```
|
| 30 |
|
| 31 |
-
*Preconditions:*
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
*Effects:* Deallocates the storage referenced by `p`.
|
| 36 |
|
| 37 |
*Remarks:* Uses `::operator delete` [[new.delete]], but it is
|
| 38 |
unspecified when this function is called.
|
|
|
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
[[nodiscard]] constexpr T* allocate(size_t n);
|
| 12 |
```
|
| 13 |
|
| 14 |
+
*Mandates:* `T` is not an incomplete type [[term.incomplete.type]].
|
| 15 |
|
| 16 |
*Returns:* A pointer to the initial element of an array of `n` `T`.
|
| 17 |
|
| 18 |
+
*Throws:* `bad_array_new_length` if
|
| 19 |
+
`numeric_limits<size_t>::max() / sizeof(T) < n`, or `bad_alloc` if the
|
| 20 |
+
storage cannot be obtained.
|
| 21 |
+
|
| 22 |
*Remarks:* The storage for the array is obtained by calling
|
| 23 |
`::operator new` [[new.delete]], but it is unspecified when or how often
|
| 24 |
this function is called. This function starts the lifetime of the array
|
| 25 |
object, but not that of any of the array elements.
|
| 26 |
|
| 27 |
+
``` cpp
|
| 28 |
+
[[nodiscard]] constexpr allocation_result<T*> allocate_at_least(size_t n);
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
*Mandates:* `T` is not an incomplete type [[term.incomplete.type]].
|
| 32 |
+
|
| 33 |
+
*Returns:* `allocation_result<T*>{ptr, count}`, where `ptr` is a pointer
|
| 34 |
+
to the initial element of an array of `count` `T` and `count` ≥ `n`.
|
| 35 |
+
|
| 36 |
*Throws:* `bad_array_new_length` if
|
| 37 |
+
`numeric_limits<size_t>::max() / sizeof(T)` < `n`, or `bad_alloc` if the
|
| 38 |
storage cannot be obtained.
|
| 39 |
|
| 40 |
+
*Remarks:* The storage for the array is obtained by calling
|
| 41 |
+
`::operator new`, but it is unspecified when or how often this function
|
| 42 |
+
is called. This function starts the lifetime of the array object, but
|
| 43 |
+
not that of any of the array elements.
|
| 44 |
+
|
| 45 |
``` cpp
|
| 46 |
constexpr void deallocate(T* p, size_t n);
|
| 47 |
```
|
| 48 |
|
| 49 |
+
*Preconditions:*
|
| 50 |
+
|
| 51 |
+
- If `p` is memory that was obtained by a call to `allocate_at_least`,
|
| 52 |
+
let `ret` be the value returned and `req` be the value passed as the
|
| 53 |
+
first argument to that call. `p` is equal to `ret.ptr` and `n` is a
|
| 54 |
+
value such that `req` ≤ `n` ≤ `ret.count`.
|
| 55 |
+
- Otherwise, `p` is a pointer value obtained from `allocate`. `n` equals
|
| 56 |
+
the value passed as the first argument to the invocation of `allocate`
|
| 57 |
+
which returned `p`.
|
| 58 |
|
| 59 |
*Effects:* Deallocates the storage referenced by `p`.
|
| 60 |
|
| 61 |
*Remarks:* Uses `::operator delete` [[new.delete]], but it is
|
| 62 |
unspecified when this function is called.
|