_d_arrayctor

fnTarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from, char * makeWeaklyPure = null) @trusted

Does array initialization (not assignment) from another array of the same element type.

Parameters

towhat array to initialize
fromwhat data the array should be initialized with
makeWeaklyPureunused; its purpose is to prevent the function from becoming strongly pure and risk being optimised out

Returns

The created and initialized array to

Bugs

This function template was ported from a much older runtime hook that bypassed safety,

purity, and throwabilty checks. To prevent breaking existing code, this function template is temporarily declared @trusted until the implementation can be brought up to modern D expectations.

The third parameter is never used, but is necessary in order for the function be treated as weakly pure, instead of strongly pure. This is needed because constructions such as the one below can be ignored by the compiler if _d_arrayctor is believed to be pure, because purity would mean the call to _d_arrayctor has no effects (no side effects and the return value is ignored), despite it actually modifying the contents of a. const S[2] b; const S[2] a = b; // this would get lowered to _d_arrayctor(a, b)