template<unsigned N>
struct RByteSwap< N >
Helper templated class for swapping bytes; specializations for N={2,4,8}
are provided below.
This class can be used to byteswap any other type, e.g. in a templated function (see example below).
template <typename T>
void byteswap_arg(T &
x) {
using value_type =
typename RByteSwap<
sizeof(T)>::value_type;
x =
RByteSwap<
sizeof(T)>::bswap(
reinterpret_cast<value_type
>(
x));
}
Helper templated class for swapping bytes; specializations for N={2,4,8} are provided below.
Definition at line 124 of file Byteswap.h.