On Mon, 05 May 2014 20:10:35 -0400, Andrei Alexandrescu <[email protected]> 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));

2. Follow the [ literal ] convention:

auto a = allok.make!(int[])(42);
assert(a.length == 1);
assert(a[0] == 42);

case 1. allok.arrayOf!int(42);

Yes, I know I got rid of the array type as the template parameter, but I don't think we want to duplicate the problem of not being able to allocate arrays on the heap that we have with 'new'.

case 2. allok.array(42); // Use IFTI

This mirrors std.array.array

In fact, 2 really should be in std.array:

array(Allocator, T...)(Allocator allok, T t) if (isAllocator!Allocator)

-Steve
  • Re: API Brian Schott via Digitalmars-d
  • Re: API Walter Bright via Digitalmars-d
    • Re: API MattCoder via Digitalmars-d
    • Re: API Andrei Alexandrescu via Digitalmars-d
      • Re: API Walter Bright via Digitalmars-d
        • Re: API Andrei Alexandrescu via Digitalmars-d
  • 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

Reply via email to