typeof([2,2]) !=? int[2]

Zhenya zheny at list.ru
Fri Mar 8 15:15:26 PST 2013


On Friday, 8 March 2013 at 23:09:07 UTC, cal wrote:
> On Friday, 8 March 2013 at 23:03:47 UTC, Zhenya wrote:
>
> Your constraint could be:
>
> if(is(typeof(size) _ == int[]) && size.length > 0)
>
> Also it looks like you are passing 1 too many template args?
>
> static if(n > 1)
>   NDimensionalArray!(T,n - 1,size[1..$]) m_array[size[0]];
>                              ^^

Yes,it's a typo.But it seems to be ugly pass dynamically 
allocated array through
a template parameter,because it's size should be compile-time 
constant.


More information about the Digitalmars-d-learn mailing list