API

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Mon May 5 17:18:44 PDT 2014


On Tuesday, 6 May 2014 at 00:10:36 UTC, Andrei Alexandrescu wrote:
> 1. Follow the new int[n] convention:
> 2. Follow the [ literal ] convention:

We could combine these pretty easily:

struct Length { size_t length; }

allok.make!(int[])(Length(42)); // #1
allok.make!(int[])(1,2,3); // #2 btw could also use IFTI here 
which is nice

This also potentially gives a third option:

allok.make!(Length(42), 5); // length == 42, all elements == 5, 
typeof(return) == typeof(args[1])[]


I kinda like that, though I'm not sure if I'd still like it if I 
used it regularly. Then, of course, we can also take other ranges 
to initialize too.


More information about the Digitalmars-d mailing list