when subobject stops becoming one

116 views Asked by At

Once an object is created which contains a few subobjects. Can those subobjects "stop" being subobjects at some point without the host object being completely re-used or destroyed?

For example:

struct A { int a; int b; };

A o;
new (&o.b) float{34.3}; // because **o** object storage is reused by a non-nesting object the lifetime of **o** shall end, is a still a subobject, or does it become a complete object?

On one hand, the standard says that the properties of an object determined at creation http://eel.is/c++draft/basic#:~:text=The%20properties%20of%20an,%E2%80%94%C2%A0end%20note%5D

But then that paragraph from the standard does list some properties. Does it mean that there are other properties that are just NOT listed?

On another hand, there is this paragraph in the standard that clearly says what a subobject is, and particularly it says that the host object must be within its lifetime...

http://eel.is/c++draft/basic#:~:text=Objects%20can%20contain,cv%2Dqualification).

0

There are 0 answers