initializing a static array

Andrea Fontana nospam at example.com
Tue Oct 10 13:48:16 UTC 2017


On Tuesday, 10 October 2017 at 13:36:56 UTC, Simon Bürger wrote:
> Is there a good way to set them all to zero? The only way I can 
> think of is using string-mixins to generate a string such as 
> "[0,0,0,0]" with exactly n zeroes. But that seems quite an 
> overkill for such a basic task. I suspect I might be missing 
> something obvious here...

Maybe:

double[n] bar = 0.repeat(n).array;


More information about the Digitalmars-d-learn mailing list