_d_arraysetlengthT

Resize a dynamic array by setting the .length property

Newly created elements are initialized to their default value.

Has two variants: - _d_arraysetlengthT for arrays with elements that initialize to 0 - _d_arraysetlengthiT for non-zero initializers retrieved from TypeInfo

void main()
{
    int[] a = [1, 2];
    a.length = 3; // gets lowered to `_d_arraysetlengthT(typeid(int[]), 3, &a)`
}
extern (C)
void[]
_d_arraysetlengthT
(
const TypeInfo ti
,
size_t newlength
,
void[]* p
)

Parameters

ti TypeInfo

TypeInfo of array

newlength size_t

new value for the array's .length

p void[]*

pointer to array to update the .length of. While it's cast to void[], its .length is still treated as element length.

Return Value

Type: void[]

*p after being updated

Meta