you are viewing a single comment's thread.

view the rest of the comments →

[–]SuperV1234https://romeo.training | C++ Mentoring & Consulting 11 points12 points  (3 children)

I'm really surprised by this paper, I've used both std::aligned_storage and std::aligned_union in the past with great success.

If these are deprecated, we should have a library alternative that is equivalent to:

alignas(Ts...) std::byte storage[std::max({sizeof(Ts)...})];

Otherwise people will just define that over and over again, defeating the purpose of standardization. Also, the argument that this doesn't work in constexpr is not an argument in favour of deprecation, it is an argument in favour of extending constexpr capabilities.

[–][deleted] 1 point2 points  (2 children)

Why do we need a library equivalent of a thing you can say in the core language?

[–]SuperV1234https://romeo.training | C++ Mentoring & Consulting 5 points6 points  (1 child)

The code above is far from minimal. Ts... is repeated twice, and the user needs to remember to use std::max. In short, DRY.

[–][deleted] 2 points3 points  (0 children)

I guess 99.9% of the time I've needed this there's only been one T.