to

Converts an array (either static or dynamic, but not associative) of ubyte to an integral number.

  1. A to(N x)
  2. N to(A arr)
    N
    to
    (
    N
    A
    )
    (
    A arr
    )
    if (
    isByteArray!(N, A) &&
    isIntegral!N
    )

Examples

import std.system : Endian, endian;

static if( endian == Endian.littleEndian )
    auto bytes = [ 10, 0, 0, 0 ];
else
    auto bytes = [ 0, 0, 0, 10 ];

int num = bytes.to!int; // 10

Meta

Authors

Tony J. Hudgins