C++ Logo


Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Thiago Macieira <thiago_at_[hidden]>
Date: Thu, 30 Nov 2023 22:02:03 +0100
On Thursday, 30 November 2023 11:17:50 CET Frederick Virchanza Gotham via Std-
Proposals wrote:
> This would allow us to write our own 'std::optional' that places the
> boolean flag inside T's trailing padding.

You can do that by inheriting from the type in question, if it is not final.

(In the IA-64 ABI; MSVC does not allow reusing the tail padding. In fact, it
has known compiler bugs causing miscompilation there)

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

Received on 2023-11-30 21:02:09