C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 11 Dec 2023 20:15:03 +0000
On Mon, Dec 11, 2023 at 1:28 AM connor horman wrote:
>
> As a note about `std::unaligned`, it's possible to implement
> `unaligned` in C++20 in fully standards compliant code.
> https://godbolt.org/z/MsWhsjoW3


Connor I've taken your code and made a few changes:
    (1) I use Arthur's compiler up on Godbolt that has 'trivially_relocatable'
    (2) Everywhere that you used 'sizeof', I instead use '__datasizeof'
    (3) I added a template assignment operator

Here's the code:
    https://godbolt.org/z/r4vWa87fd

Received on 2023-12-11 20:15:09