Daily bit(e) of C++ | std::byteswap
Daily bit(e) of C++ #397, The C++23 utility for changing the order of bytes in an integral variable.
std::byteswap is a simple C++23 utility from the <bit> header that swaps the order of bytes in an integral variable.
In combination with std::endian (C++20), std::byteswap offers a portable solution when serialized data is stored in a different byte order than the native endianness.