C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [[packed]] std::unaligned

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 14 Dec 2023 10:07:16 -0300
On Wednesday, 13 December 2023 21:26:09 -03 Frederick Virchanza Gotham via
Std-Proposals wrote:
> For some people here on the mailing list,
> that's enough and they don't want more. I wanted to go a step further
> with it though and make it more versatile than that -- I think
> std::unaligned should be able to work with pretty much any class.

And it took me 4.2 seconds to find a counter-example proving that it can't be
done generally for non-trivial types. One counter-example suffices to disprove,
leading me to post that the idea was DoA.

It might be possible for non-trivial but trivially-relocatable types using
your technique. But that's not what you proposed.

PS: forget __datasizeof exists.

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

Received on 2023-12-14 13:07:19