create and initialise array

Alex bo at bo.com
Thu Jun 20 01:06:09 UTC 2019


Is there a way of creating and initialising a dynamic array ?

for example I am doing this:

auto arr = new float[<big number>];
arr[] = 0.0f;

Profiling indicates that the compiler (gdc) is spending 
significant time memsetting the whole array to something (nan ?) 
before I immediately memset it to 0.0f.

It would be good if there was a way of either void initialing it 
so that the first memset is avoided or a way of replacing the 
init value with a different one.

Thanks,
Alex


More information about the Digitalmars-d-learn mailing list