Skip to content

Commit 0c53bea

Browse files
jensmaurertkoeppe
authored andcommitted
[unique.ptr.single] Rephrase destruction
1 parent e6c0390 commit 0c53bea

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

source/utilities.tex

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11525,17 +11525,17 @@
1152511525

1152611526
\begin{itemdescr}
1152711527
\pnum
11528-
\expects
11529-
The expression \tcode{get_deleter()(get())} is well-formed,
11530-
has well-defined behavior, and does not throw exceptions.
11528+
\effects
11529+
Equivalent to:
11530+
\tcode{if (get()) get_deleter()(get());}
1153111531
\begin{note}
1153211532
The use of \tcode{default_delete} requires \tcode{T} to be a complete type.
1153311533
\end{note}
1153411534

1153511535
\pnum
11536-
\effects
11537-
If \tcode{get() == nullptr} there are no effects.
11538-
Otherwise \tcode{get_deleter()(get())}.
11536+
\remarks
11537+
The behavior is undefined
11538+
if the evaluation of \tcode{get_deleter()(get())} throws an exception.
1153911539
\end{itemdescr}
1154011540

1154111541
\rSec4[unique.ptr.single.asgn]{Assignment}
@@ -11728,16 +11728,11 @@
1172811728
\end{itemdecl}
1172911729

1173011730
\begin{itemdescr}
11731-
\pnum
11732-
\expects
11733-
The expression \tcode{get_deleter()(get())} is well-formed,
11734-
has well-defined behavior, and does not throw exceptions.
11735-
1173611731
\pnum
1173711732
\effects
11738-
Assigns \tcode{p} to the stored pointer, and then if and only if the old value of the
11739-
stored pointer, \tcode{old_p}, was not equal to \keyword{nullptr}, calls
11740-
\tcode{get_deleter()(old_p)}.
11733+
Assigns \tcode{p} to the stored pointer, and then,
11734+
with the old value of the stored pointer, \tcode{old_p},
11735+
evaluates \tcode{if (old_p) get_deleter()(old_p);}
1174111736
\begin{note}
1174211737
The order of these operations is significant
1174311738
because the call to \tcode{get_deleter()} might destroy \tcode{*this}.
@@ -11750,6 +11745,11 @@
1175011745
The postcondition does not hold if the call to \tcode{get_deleter()}
1175111746
destroys \tcode{*this} since \tcode{this->get()} is no longer a valid expression.
1175211747
\end{note}
11748+
11749+
\pnum
11750+
\remarks
11751+
The behavior is undefined
11752+
if the evaluation of \tcode{get_deleter()(old_p)} throws an exception.
1175311753
\end{itemdescr}
1175411754

1175511755
\indexlibrarymember{swap}{unique_ptr}%

0 commit comments

Comments
 (0)