Re:Why introduce `std::launder` rather than have the compile...
by webkike on Saturday January 22, 2022 @07:52AM
(#30036231)
I’ve fixed undefined behavior in large C++ code based caused by misaligned reinterpret casts - the solution is to use memcpy
[ Parent
| on HN ]
Re:Why introduce `std::launder` rather than have the compile...
by allo37 on Saturday January 22, 2022 @08:26AM
(#30036403)
It's such a good idea that they made a special cast that does just that in C++20: https://en.cppreference.com/w/cpp/numeric/bit_cast