Templated Interfaces?

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Aug 26 06:49:35 PDT 2008


"Ary Borenszweig" <ary at esperanto.org.ar> wrote in message 
news:g8vp2l$11nf$1 at digitalmars.com...
>
> Ouch. I first wrote
>
> I!(char)[3] array = new I!(char)[3];
>
> which compiles, and makes array a static array (you can't append to it). 
> Then, for simplicity, I changed the type to auto... it seems new makes a 
> dynamic array, but then it is implicitly converted to a static one, right?

No.  When you write

auto x = Y;

it is identical to writing

typeof(Y) x = Y;

In this case, typeof(new I!(char)[3]) is I!(char)[].  A dynamic array. 




More information about the Digitalmars-d-learn mailing list