Skip to content

Commit

Permalink
[basic.life] Reference [intro.object] in transparent replacement note…
Browse files Browse the repository at this point in the history
… and improve example
  • Loading branch information
Eisenwave committed Oct 21, 2024
1 parent a470ff8 commit 48ec7be
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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}
Expand Down

0 comments on commit 48ec7be

Please sign in to comment.