tmp/tmpplxb6kl1/{from.md → to.md}
RENAMED
|
@@ -1,35 +1,39 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
Except for the destructor, member functions of the default allocator
|
| 4 |
-
shall not introduce data races
|
| 5 |
concurrent calls to those member functions from different threads. Calls
|
| 6 |
to these functions that allocate or deallocate a particular unit of
|
| 7 |
storage shall occur in a single total order, and each such deallocation
|
| 8 |
call shall happen before the next allocation (if any) in this order.
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
-
T* allocate(size_t n);
|
| 12 |
```
|
| 13 |
|
| 14 |
-
*
|
| 15 |
-
size `n` `* sizeof(T)`, aligned appropriately for objects of type `T`.
|
| 16 |
|
| 17 |
-
*
|
| 18 |
-
`::operator new` ([[new.delete]]), but it is unspecified when or how
|
| 19 |
-
often this function is called.
|
| 20 |
|
| 21 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
-
void deallocate(T* p, size_t n);
|
| 25 |
```
|
| 26 |
|
| 27 |
-
*
|
| 28 |
-
|
| 29 |
allocate which returned `p`.
|
| 30 |
|
| 31 |
*Effects:* Deallocates the storage referenced by `p` .
|
| 32 |
|
| 33 |
-
*Remarks:* Uses `::operator delete`
|
| 34 |
unspecified when this function is called.
|
| 35 |
|
|
|
|
| 1 |
+
#### Members <a id="allocator.members">[[allocator.members]]</a>
|
| 2 |
|
| 3 |
Except for the destructor, member functions of the default allocator
|
| 4 |
+
shall not introduce data races [[intro.multithread]] as a result of
|
| 5 |
concurrent calls to those member functions from different threads. Calls
|
| 6 |
to these functions that allocate or deallocate a particular unit of
|
| 7 |
storage shall occur in a single total order, and each such deallocation
|
| 8 |
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 [[basic.types]].
|
|
|
|
| 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:* `p` is a pointer value obtained from `allocate()`. `n`
|
| 32 |
+
equals the value passed as the first argument to the invocation of
|
| 33 |
allocate which returned `p`.
|
| 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.
|
| 39 |
|