C++ Logo


Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Tue, 12 Dec 2023 18:11:00 +0000
On Tue, Dec 12, 2023 at 1:48 PM Arthur O'Dwyer wrote:

> ~unaligned() requires std::is_trivially_destructible<T> = default;
> ~unaligned() { alignas(T) std::byte ~~~~ tmp.~T(); }


I don't know if it would ever make sense to have an
'unaligned<std::string>' but anyway here's my first attempt:


The main thing is that 'unaligned' shall remain trivial is T is
trivial -- but that 'unaligned' can still be used for non-trivial

Received on 2023-12-12 18:11:07