C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 03 Dec 2023 14:28:18 -0800
On Sunday, 3 December 2023 13:48:38 PST Frederick Virchanza Gotham via Std-
Proposals wrote:
> But people haven't been memcpy'ing and memset'ing empty base classes
> for a few decades.

Because polymorphic base classes can't be because of hidden members like the
pointer to the vtable. You could conceivably memcpy it out and back in, but
only to the same object, so I don't see the point in doing that. You can't
clone a polymorphic object using memcpy.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-12-03 22:28:19