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.
  • API Andrei Alexandrescu via Digitalmars-d
    • Re: API Adam D. Ruppe via Digitalmars-d
      • Re: API Adam D. Ruppe via Digitalmars-d
        • Re: API bearophile via Digitalmars-d
          • Re: API Adam D. Ruppe via Digitalmars-d
            • Re: API bearophile via Digitalmars-d
              • Re: API Adam D. Ruppe via Digitalmars-d
      • Re: API Orvid King via Digitalmars-d
    • Re: API bearophile via Digitalmars-d
      • Re: API H. S. Teoh via Digitalmars-d
    • Re: API Brian Schott via Digitalmars-d
    • Re: API Walter Bright via Digitalmars-d

Reply via email to