Comment on The strict aliasing situation is pretty bad (2016)parentComments−spacechild11yIn fairness, recent versions of C++ have been adding ways to express each of these cases directly, eliminating the need to use obtuse incantations.In particular, C++20 gave us std::bit_cast (https://en.cppreference.com/w/cpp/numeric/bit_cast) for type punning and C++23 added std::start_life_time_as (https://en.cppreference.com/w/cpp/memory/start_lifetime_as) for interpreting raw bytes as an object.−helltone1ystd::start_life_time_as and std::launder honestly feel like a massive hack
Comments
In particular, C++20 gave us std::bit_cast (https://en.cppreference.com/w/cpp/numeric/bit_cast) for type punning and C++23 added std::start_life_time_as (https://en.cppreference.com/w/cpp/memory/start_lifetime_as) for interpreting raw bytes as an object.
std::start_life_time_as and std::launder honestly feel like a massive hack