C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Thu, 30 Nov 2023 15:36:05 -0500
On Thu, Nov 30, 2023 at 5:18 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:

> Following on from the discussion about "std::optional<T>::abandon",
> I'd like to discuss whether it would be helpful to be able to know at
> compile time how much trailing padding there is inside a type?


This is the `__datasizeof` builtin. In chronological order:
https://orodu.net/2023/01/15/trivially-relocatable.html (Ctrl+F
data_size_of)
https://quuxplusone.github.io/blog/2023/02/24/trivial-swap-x-prize/#if-stdswap-cant-memcpy-then-how-do-we-trivially-swap
https://clang.llvm.org/docs/LanguageExtensions.html#implementation-defined-keywords

–Arthur

Received on 2023-11-30 20:36:19