4 ms·
memcpy is the only defined way to type pun in C++. Anyone intentionally avoiding it probably has UB instead.
by jeffbee 5y ago
memcpy is the only defined way to type pun in C++. Anyone intentionally avoiding it probably has UB instead.
- pjmlp 5y agoStarting with C++20, std::bit_cast is also an option. https://en.cppreference.com/w/cpp/numeric/bit_cast https://en.cppreference.com/w/cpp/numeric/bit_cast