22
General utilities library
[utilities]
22.15
Bit manipulation
[bit]
22.15.4
byteswap
[bit.byteswap]
ðŸ”—
template
<
class
T
>
constexpr
T byteswap
(
T value
)
noexcept
;
1
#
Constraints
:
T
models
integral
.
2
#
Mandates
:
T
does not have padding bits (
[basic.
types.
general]
)
.
3
#
Let the sequence
R
comprise the bytes of the object representation of
value
in reverse order
.
4
#
Returns
: An object
v
of type
T
such that each byte in the object representation of
v
is equal to the byte in the corresponding position in
R
.