class template as a type
BCS
ao at pathlink.com
Tue Sep 18 21:04:03 PDT 2007
Reply to Karl,
> Hi,
>
> I've been playing around with templates, i'm a newbie in this matter,
> i created a class template and i want to use it as a type in functions
> and create arrays of it. Any help please.
>
> Code sample:
>
> module hello;
>
> template Test(alias T)
> {
> class Test
> {
> this(){} int x; ...
> }
> }
> void Foo(Test t){}
>
> static Test[] myarray;
>
void Foo(Test!(somthingToAlias) { }
static Test!(somthingToAlias)[] myarray;
look for "Explicit Template Instantiation" in
http://www.digitalmars.com/d/template.html
More information about the Digitalmars-d-learn
mailing list