tmp/tmpzyrgkasy/{from.md → to.md}
RENAMED
|
@@ -1,42 +1,35 @@
|
|
| 1 |
#### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
-
|
| 5 |
-
|
| 6 |
```
|
| 7 |
|
| 8 |
*Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
|
| 9 |
called by the array form of a *new-expression*[[expr.new]] to allocate
|
| 10 |
`size` bytes of storage. The second form is called for a type with
|
| 11 |
new-extended alignment, and the first form is called otherwise.[^31]
|
| 12 |
|
| 13 |
-
*Replaceable:* A C++ program may define functions with either of these
|
| 14 |
-
function signatures, and thereby displace the default versions defined
|
| 15 |
-
by the C++ standard library.
|
| 16 |
-
|
| 17 |
*Required behavior:* Same as for the corresponding single-object forms.
|
| 18 |
This requirement is binding on any replacement versions of these
|
| 19 |
functions.
|
| 20 |
|
| 21 |
*Default behavior:* Returns `operator new(size)`, or
|
| 22 |
`operator new(size, alignment)`, respectively.
|
| 23 |
|
|
|
|
|
|
|
| 24 |
``` cpp
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
const std::nothrow_t&) noexcept;
|
| 28 |
```
|
| 29 |
|
| 30 |
*Effects:* Same as above, except that these are called by a placement
|
| 31 |
version of a *new-expression* when a C++ program prefers a null pointer
|
| 32 |
result as an error indication, instead of a `bad_alloc` exception.
|
| 33 |
|
| 34 |
-
*Replaceable:* A C++ program may define functions with either of these
|
| 35 |
-
function signatures, and thereby displace the default versions defined
|
| 36 |
-
by the C++ standard library.
|
| 37 |
-
|
| 38 |
*Required behavior:* Return a non-null pointer to suitably aligned
|
| 39 |
storage [[basic.stc.dynamic]], or else return a null pointer. Each of
|
| 40 |
these nothrow versions of `operator new[]` returns a pointer obtained as
|
| 41 |
if acquired from the (possibly replaced) corresponding non-placement
|
| 42 |
function. This requirement is binding on any replacement versions of
|
|
@@ -45,10 +38,12 @@ these functions.
|
|
| 45 |
*Default behavior:* Calls `operator new[](size)`, or
|
| 46 |
`operator new[](size, alignment)`, respectively. If the call returns
|
| 47 |
normally, returns the result of that call. Otherwise, returns a null
|
| 48 |
pointer.
|
| 49 |
|
|
|
|
|
|
|
| 50 |
``` cpp
|
| 51 |
void operator delete[](void* ptr) noexcept;
|
| 52 |
void operator delete[](void* ptr, std::size_t size) noexcept;
|
| 53 |
void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
|
| 54 |
void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
|
@@ -69,38 +64,36 @@ returned `ptr`.
|
|
| 69 |
|
| 70 |
*Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
|
| 71 |
called by the array form of a *delete-expression* to render the value of
|
| 72 |
`ptr` invalid.
|
| 73 |
|
| 74 |
-
*Replaceable:* A C++ program may define functions with any of these
|
| 75 |
-
function signatures, and thereby displace the default versions defined
|
| 76 |
-
by the C++ standard library.
|
| 77 |
-
|
| 78 |
-
If a function without a `size` parameter is defined, the program should
|
| 79 |
-
also define the corresponding function with a `size` parameter. If a
|
| 80 |
-
function with a `size` parameter is defined, the program shall also
|
| 81 |
-
define the corresponding version without the `size` parameter.
|
| 82 |
-
|
| 83 |
-
[*Note 1*: The default behavior below might change in the future, which
|
| 84 |
-
will require replacing both deallocation functions when replacing the
|
| 85 |
-
allocation function. — *end note*]
|
| 86 |
-
|
| 87 |
*Required behavior:* A call to an `operator delete[]` with a `size`
|
| 88 |
parameter may be changed to a call to the corresponding
|
| 89 |
`operator delete[]` without a `size` parameter, without affecting memory
|
| 90 |
allocation.
|
| 91 |
|
| 92 |
-
[*Note
|
| 93 |
`operator delete[](void* ptr, std::size_t size)` to simply call
|
| 94 |
`operator delete[](ptr)`. — *end note*]
|
| 95 |
|
| 96 |
*Default behavior:* The functions that have a `size` parameter forward
|
| 97 |
their other parameters to the corresponding function without a `size`
|
| 98 |
parameter. The functions that do not have a `size` parameter forward
|
| 99 |
their parameters to the corresponding `operator delete` (single-object)
|
| 100 |
function.
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
``` cpp
|
| 103 |
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
|
| 104 |
void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
| 105 |
```
|
| 106 |
|
|
@@ -118,12 +111,10 @@ allocation function that returned `ptr`.
|
|
| 118 |
*Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
|
| 119 |
called by the implementation to render the value of `ptr` invalid when
|
| 120 |
the constructor invoked from a nothrow placement version of the array
|
| 121 |
*new-expression* throws an exception.
|
| 122 |
|
| 123 |
-
*Replaceable:* A C++ program may define functions with either of these
|
| 124 |
-
function signatures, and thereby displace the default versions defined
|
| 125 |
-
by the C++ standard library.
|
| 126 |
-
|
| 127 |
*Default behavior:* Calls `operator delete[](ptr)`, or
|
| 128 |
`operator delete[](ptr, alignment)`, respectively.
|
| 129 |
|
|
|
|
|
|
|
|
|
| 1 |
#### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
+
void* operator new[](std::size_t size);
|
| 5 |
+
void* operator new[](std::size_t size, std::align_val_t alignment);
|
| 6 |
```
|
| 7 |
|
| 8 |
*Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
|
| 9 |
called by the array form of a *new-expression*[[expr.new]] to allocate
|
| 10 |
`size` bytes of storage. The second form is called for a type with
|
| 11 |
new-extended alignment, and the first form is called otherwise.[^31]
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
*Required behavior:* Same as for the corresponding single-object forms.
|
| 14 |
This requirement is binding on any replacement versions of these
|
| 15 |
functions.
|
| 16 |
|
| 17 |
*Default behavior:* Returns `operator new(size)`, or
|
| 18 |
`operator new(size, alignment)`, respectively.
|
| 19 |
|
| 20 |
+
*Remarks:* This function is replaceable [[term.replaceable.function]].
|
| 21 |
+
|
| 22 |
``` cpp
|
| 23 |
+
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
|
| 24 |
+
void* operator new[](std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
|
|
|
| 25 |
```
|
| 26 |
|
| 27 |
*Effects:* Same as above, except that these are called by a placement
|
| 28 |
version of a *new-expression* when a C++ program prefers a null pointer
|
| 29 |
result as an error indication, instead of a `bad_alloc` exception.
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
*Required behavior:* Return a non-null pointer to suitably aligned
|
| 32 |
storage [[basic.stc.dynamic]], or else return a null pointer. Each of
|
| 33 |
these nothrow versions of `operator new[]` returns a pointer obtained as
|
| 34 |
if acquired from the (possibly replaced) corresponding non-placement
|
| 35 |
function. This requirement is binding on any replacement versions of
|
|
|
|
| 38 |
*Default behavior:* Calls `operator new[](size)`, or
|
| 39 |
`operator new[](size, alignment)`, respectively. If the call returns
|
| 40 |
normally, returns the result of that call. Otherwise, returns a null
|
| 41 |
pointer.
|
| 42 |
|
| 43 |
+
*Remarks:* This function is replaceable [[term.replaceable.function]].
|
| 44 |
+
|
| 45 |
``` cpp
|
| 46 |
void operator delete[](void* ptr) noexcept;
|
| 47 |
void operator delete[](void* ptr, std::size_t size) noexcept;
|
| 48 |
void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
|
| 49 |
void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
|
|
|
| 64 |
|
| 65 |
*Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
|
| 66 |
called by the array form of a *delete-expression* to render the value of
|
| 67 |
`ptr` invalid.
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
*Required behavior:* A call to an `operator delete[]` with a `size`
|
| 70 |
parameter may be changed to a call to the corresponding
|
| 71 |
`operator delete[]` without a `size` parameter, without affecting memory
|
| 72 |
allocation.
|
| 73 |
|
| 74 |
+
[*Note 1*: A conforming implementation is for
|
| 75 |
`operator delete[](void* ptr, std::size_t size)` to simply call
|
| 76 |
`operator delete[](ptr)`. — *end note*]
|
| 77 |
|
| 78 |
*Default behavior:* The functions that have a `size` parameter forward
|
| 79 |
their other parameters to the corresponding function without a `size`
|
| 80 |
parameter. The functions that do not have a `size` parameter forward
|
| 81 |
their parameters to the corresponding `operator delete` (single-object)
|
| 82 |
function.
|
| 83 |
|
| 84 |
+
*Remarks:* This function is replaceable [[term.replaceable.function]].
|
| 85 |
+
If a replacement function without a `size` parameter is defined by the
|
| 86 |
+
program, the program should also define the corresponding function with
|
| 87 |
+
a `size` parameter. If a replacement function with a `size` parameter is
|
| 88 |
+
defined by the program, the program shall also define the corresponding
|
| 89 |
+
version without the `size` parameter.
|
| 90 |
+
|
| 91 |
+
[*Note 2*: The default behavior above might change in the future, which
|
| 92 |
+
will require replacing both deallocation functions when replacing the
|
| 93 |
+
allocation function. — *end note*]
|
| 94 |
+
|
| 95 |
``` cpp
|
| 96 |
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
|
| 97 |
void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
| 98 |
```
|
| 99 |
|
|
|
|
| 111 |
*Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
|
| 112 |
called by the implementation to render the value of `ptr` invalid when
|
| 113 |
the constructor invoked from a nothrow placement version of the array
|
| 114 |
*new-expression* throws an exception.
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
*Default behavior:* Calls `operator delete[](ptr)`, or
|
| 117 |
`operator delete[](ptr, alignment)`, respectively.
|
| 118 |
|
| 119 |
+
*Remarks:* This function is replaceable [[term.replaceable.function]].
|
| 120 |
+
|