On Wednesday, 7 May 2014 at 16:12:15 UTC, Byron wrote:
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

would have been cool if something like this worked:

template make(T : U[n], U, alias n)

i.e
int dim = 42;
make!int[dim]








  • Re: API Idan Arye via Digitalmars-d
  • Re: API Brad Anderson via Digitalmars-d
    • Re: API bearophile via Digitalmars-d
  • Re: API ed via Digitalmars-d
  • Re: API Steven Schveighoffer via Digitalmars-d
  • Re: API Yota via Digitalmars-d
  • Re: API Andrei Alexandrescu via Digitalmars-d
  • Re: API Dmitry Olshansky via Digitalmars-d
    • Re: API Steven Schveighoffer via Digitalmars-d
  • Re: API Byron via Digitalmars-d
    • Re: API Xiaoxi via Digitalmars-d

Reply via email to