C++ Logo


Advanced search

Re: [std-proposals] this return type

From: Jan Schultke <janschultke_at_[hidden]>
Date: Sun, 9 Apr 2023 14:09:50 +0200
I've looked at the requirements in C++98 and they are similar.
However, what if S is the base class, and inside of foo(), replacement
of a subobject takes place. We might not be able to transparently
replace a subobject and have references to the subobject stay valid,
but what about the base object.

The section you've quoted only limits transparent replacement of
references to the subobject, but references to the base object might
need to stay valid.

In such a case, you could replace the base class subobject (which
invalidates all references to the subobject), but the base object's
lifetime should be unaffected, but the vtable would be altered because
of a change in the subobject.


Received on 2023-04-09 12:10:03