Function toHostOrder

Converts the ubyte input range range to T.

T toHostOrder(T, R) (
  R range
)
if (isInputRange!R && !isInfinite!R && is(Unqual!(ElementType!R) == ubyte) && isUnsigned!T);

The byte order of r is assumed to be big-endian. The length cannot be larger than T.sizeof. Otherwise an assertion failure will be caused.

Parameters

NameDescription
T Desired return type.
R Range type.
range Input range.

Returns

Integral representation of range with the host byte order.

Example

const value = 0xae34e2u;
auto networkOrder = NetworkOrder!4(value);
assert(networkOrder.toHostOrder() == value);