API

Byron via Digitalmars-d digitalmars-d at puremagic.com
Wed May 7 09:12:15 PDT 2014


On Mon, 05 May 2014 17:10:35 -0700, Andrei Alexandrescu wrote:

> So I'm looking at creation functions and in particular creation
> functions for arrays.
> 
> 1. Follow the new int[n] convention:
> 
> auto a = allok.make!(int[])(42);
> assert(a.length == 42);
> assert(a.equal(repeat(0, 42));

Why not use make for length only

> 
> 2. Follow the [ literal ] convention:
> 
> auto a = allok.make!(int[])(42);
> assert(a.length == 1);
> assert(a[0] == 42);
> 

And build here for building up the array


More information about the Digitalmars-d mailing list