Templated Interfaces?

Sergey Gromov snake.scaly at gmail.com
Mon Aug 25 05:41:10 PDT 2008


Ary Borenszweig <ary at esperanto.org.ar> wrote:
> If you put an integer into the array declaration, it *is* declared as a 
> static array.
> 
> 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

import std.stdio;
void main() {
	auto a = new int[3];
	writeln(typeof(a).stringof);
}

prints "int[]".  new expression *always* produces a dynamic array.

-- 
SnakE


More information about the Digitalmars-d-learn mailing list