Additions to std.array.

Boost License 1.0.
Denis Shelomovskij

pure nothrow ref @trusted auto  asFlatStaticArray(T, size_t n = staticArrayDims!T)(ref T t);
pure nothrow ref @safe auto  asFlatStaticArray(size_t n, T)(ref T t);

Represents value as a flat (single-dimension) static array. Considers T to be an n-dimensional static array type.

See also unstd.traits.MultidimStaticArrayElementType, unstd.traits.multidimStaticArrayElementCount.

int i;
static assert(is(typeof(asFlatStaticArray(i)) == int[1]));
asFlatStaticArray(i)[] = 5;
assert(i == 5);

int[1][2][3] mdimSArr;
static assert(is(typeof(asFlatStaticArray(mdimSArr)) == int[6]));
asFlatStaticArray(mdimSArr) = [1, 2, 3, 4, 5, 6];
assert(mdimSArr == [[[1], [2]], [[3], [4]], [[5], [6]]]);

static assert(is(typeof(asFlatStaticArray!2(mdimSArr)) == int[1][6]));
assert(asFlatStaticArray!2(mdimSArr) == [[1], [2], [3], [4], [5], [6]]);

pure nothrow @system void  rawCopy(T)(ref const T src, ref T dest);
pure nothrow @system void  rawCopy(T)(in T* src, T* dest, size_t count);

Binary copies src to dest. src and dest can overlap.

This function is a preffered way over C's memcpy and memmove as it's CTFE-able and can work faster than C's ones as it knows data type.