Compiling Templates

Saaa empty at needmail.com
Mon Jun 29 17:25:30 PDT 2009


Always nice to see the inner workings, thanks.

Here a few things that bugged me:
Seeing templates as runtime functions, making the whole instantiation thing 
kind of strange :)
Trying to use implicitly deduces parameters for function templates.
Writing Foo(d) iso Foo!(int [][])(d).

--
template Foo(T: T[])
{
  void Foo(T array)
  {
    writefln(T.stringof);
  }
}

void main()
{
  int[] d;
  Foo!(int [][])(d);
//intuitively I wrote int[] at first as that is what I want T to be
} 




More information about the Digitalmars-d-learn mailing list