Subject: Re: Values of objects
From: Hyman Rosen (hyrosen_at_[hidden])
Date: 2019-08-29 10:28:57
On Wed, Aug 28, 2019 at 8:17 PM Krystian Stasiowski via Std-Discussion <
> > A type has a contiguous object representation and a subset, possibly
> non-contiguous, value representation.
> So how would virtual bases fit into this model?
The same way they do now? What do you think is the problem?
If I have a class M in a complex inheritance hierarchy, including
virtual base classes, I can do
alignas(M) unsigned char buf[sizeof(M)];
M *pm = new (buf) M;
and get an M object fully contained inside buf, including all the virtual
base class subobjects. The virtual table for M contains offsets that
describe where in that storage the virtual bases can be found. The
virtual table is not part of the value of the M object, but the pointers
to the virtual tables are.
In my model (as well as in the standard one), member and base class
subobjects always contain their full value representation but may not
contain their full object representation (so no_unique_address and the
special empty base class layout still work).
STD-DISCUSSION list run by herb.sutter at gmail.com
Older Archives on Google Groups