Templated Interfaces?

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Aug 25 06:54:00 PDT 2008


"Ary Borenszweig" <ary at esperanto.org.ar> wrote in message 
news:g8u542$b39$1 at digitalmars.com...

> Static array:
> -------------
> auto array = new I!(char)[3];
>  - array is of type I!(char)[3] (static array)
>  - you cannot append using ~
>  - you can assign or access using indices
>  - you can initialize it like that or using an array literal

No, new I!(char)[3] is syntactic sugar for new I!(char)[](3) and allocates a 
3-element I!(char)[].

Fun fact: it is actually impossible within the syntax of D to allocate a 
static array on the heap.  Not really surprising given the horrible 
treatment of static arrays in general. 




More information about the Digitalmars-d-learn mailing list