On Tuesday, 26 March 2013 at 05:40:00 UTC, Steven Schveighoffer
wrote:
What you have to do is instantiate the template, then call the
constructor:
S!(int, 4).S!(byte, 5)(3)
Note that the way templates work in D, a templated struct is
really a shortcut for:
template S(T)
{
struct S { ... }
}
So when you instantiate it, S!(int)(5) is really shorthand for
S!(int).S(5).
Every template is this way. The shorthand version calls on the
"eponymous" member implicitly, that is, the member with the
same name as the template. Currently, this only works if there
is exactly one member.
For example, a function template is really:
template foo(T)
{
void foo(T t) {...}
}
So doing:
foo!(int)(1)
is really the same as:
foo!(int).foo(1)
It's all outlined here: http://dlang.org/template.html
search for Implicit Template Properties
-Steve
Thx a lot!