From 48ec7be9a59ce69a3250e3a11e3c9d8001cb7010 Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Mon, 21 Oct 2024 07:02:16 +0200 Subject: [PATCH] [basic.life] Reference [intro.object] in transparent replacement note and improve example --- source/basic.tex | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/source/basic.tex b/source/basic.tex index 9524265f81..4d21f2303e 100644 --- a/source/basic.tex +++ b/source/basic.tex @@ -3660,6 +3660,13 @@ lifetime of the new object has started, can be used to manipulate the new object. +\begin{note} +Additionally, if the requirements in \ref{intro.object} +for the creation of subobjects are met, +once the lifetime of the new object has started, +the containing object of the original object +can be used to manipulate the new object. +\end{note} \begin{example} \begin{codeblock} struct C { @@ -3677,10 +3684,14 @@ return *this; } -C c1; -C c2; -c1 = c2; // well-defined -c1.f(); // well-defined; \tcode{c1} refers to a new object of type \tcode{C} +void g() { + C c1; + C c2; + c1 = c2; // well-defined + c1.f(); // well-defined; \tcode{c1} refers to a new object of type \tcode{C} + new (&c1.i) int(42); // well-defined + int j = c1.i; // well-defined +} \end{codeblock} \end{example} \begin{note}