October 24, 2005
Given this code:

class array(T)
{
  static T[] opIndex(T[] a ...)
  {
    return a.dup;
  }
}

This doesn't work:

float[] a = array!(float)[1,2,3];

DMD(0.135) Compiler complains:

animacija.d(48): only one index allowed to index void
animacija.d(48): class array must be an array or pointer type, not void
animacija.d(48): cannot implicitly convert expression (class array[1]) of type int to float[]

But this works:

alias array!(float) type;
float[] a = type[1,2,3];
October 28, 2005
Ivan Senji schrieb am 2005-10-24:
> Given this code:
>
> class array(T)
> {
>    static T[] opIndex(T[] a ...)
>    {
>      return a.dup;
>    }
> }
>
> This doesn't work:
>
> float[] a = array!(float)[1,2,3];
>
> DMD(0.135) Compiler complains:
>
> animacija.d(48): only one index allowed to index void
> animacija.d(48): class array must be an array or pointer type, not void
> animacija.d(48): cannot implicitly convert expression (class array[1])
> of type int to float[]
>
> But this works:
>
> alias array!(float) type;
> float[] a = type[1,2,3];

Added to DStress as http://dstress.kuehne.cn/run/t/template_class_11_A.d http://dstress.kuehne.cn/run/t/template_class_11_B.d

Thomas