tmp/tmpjsaz_2in/{from.md → to.md}
RENAMED
|
@@ -1,41 +1,44 @@
|
|
| 1 |
-
#### Deallocation functions <a id="basic.stc.dynamic.deallocation">[[basic.stc.dynamic.deallocation]]</a>
|
| 2 |
|
| 3 |
Deallocation functions shall be class member functions or global
|
| 4 |
functions; a program is ill-formed if deallocation functions are
|
| 5 |
declared in a namespace scope other than global scope or declared static
|
| 6 |
in global scope.
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
`std::align_val_t` or `std::size_t` [^14]; or
|
| 16 |
-
- exactly three parameters, the type of the second being `std::size_t`
|
| 17 |
-
and the type of the third being `std::align_val_t`.
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
-
A
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
If a deallocation function terminates by throwing an exception, the
|
| 32 |
behavior is undefined. The value of the first argument supplied to a
|
| 33 |
deallocation function may be a null pointer value; if so, and if the
|
| 34 |
deallocation function is one supplied in the standard library, the call
|
| 35 |
has no effect.
|
| 36 |
|
| 37 |
If the argument given to a deallocation function in the standard library
|
| 38 |
-
is a pointer that is not the null pointer value
|
| 39 |
deallocation function shall deallocate the storage referenced by the
|
| 40 |
pointer, ending the duration of the region of storage.
|
| 41 |
|
|
|
|
| 1 |
+
##### Deallocation functions <a id="basic.stc.dynamic.deallocation">[[basic.stc.dynamic.deallocation]]</a>
|
| 2 |
|
| 3 |
Deallocation functions shall be class member functions or global
|
| 4 |
functions; a program is ill-formed if deallocation functions are
|
| 5 |
declared in a namespace scope other than global scope or declared static
|
| 6 |
in global scope.
|
| 7 |
|
| 8 |
+
A deallocation function is a *destroying operator delete* if it has at
|
| 9 |
+
least two parameters and its second parameter is of type
|
| 10 |
+
`std::destroying_delete_t`. A destroying operator delete shall be a
|
| 11 |
+
class member function named `operator delete`.
|
| 12 |
|
| 13 |
+
[*Note 5*: Array deletion cannot use a destroying operator
|
| 14 |
+
delete. — *end note*]
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
Each deallocation function shall return `void`. If the function is a
|
| 17 |
+
destroying operator delete declared in class type `C`, the type of its
|
| 18 |
+
first parameter shall be `C*`; otherwise, the type of its first
|
| 19 |
+
parameter shall be `void*`. A deallocation function may have more than
|
| 20 |
+
one parameter. A *usual deallocation function* is a deallocation
|
| 21 |
+
function whose parameters after the first are
|
| 22 |
|
| 23 |
+
- optionally, a parameter of type `std::destroying_delete_t`, then
|
| 24 |
+
- optionally, a parameter of type `std::size_t` [^15], then
|
| 25 |
+
- optionally, a parameter of type `std::align_val_t`.
|
| 26 |
|
| 27 |
+
A destroying operator delete shall be a usual deallocation function. A
|
| 28 |
+
deallocation function may be an instance of a function template. Neither
|
| 29 |
+
the first parameter nor the return type shall depend on a template
|
| 30 |
+
parameter. A deallocation function template shall have two or more
|
| 31 |
+
function parameters. A template instance is never a usual deallocation
|
| 32 |
+
function, regardless of its signature.
|
| 33 |
|
| 34 |
If a deallocation function terminates by throwing an exception, the
|
| 35 |
behavior is undefined. The value of the first argument supplied to a
|
| 36 |
deallocation function may be a null pointer value; if so, and if the
|
| 37 |
deallocation function is one supplied in the standard library, the call
|
| 38 |
has no effect.
|
| 39 |
|
| 40 |
If the argument given to a deallocation function in the standard library
|
| 41 |
+
is a pointer that is not the null pointer value [[basic.compound]], the
|
| 42 |
deallocation function shall deallocate the storage referenced by the
|
| 43 |
pointer, ending the duration of the region of storage.
|
| 44 |
|