How to define templates

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Mar 29 10:54:08 PDT 2009


On Sun, Mar 29, 2009 at 1:46 PM, Steve Teale
<steve.teale at britseyeview.com> wrote:
> The documentation says:
>
> TemplateDeclaration:
>        template TemplateIdentifier ( TemplateParameterList ) Constraint(opt)
>                { DeclDefs }
>
> DeclDefs as defined where?

http://www.digitalmars.com/d/2.0/module.html

> What should be the effect of the following?
>
> import std.stdio;
>
> template gnomeSaying(T, U, V, string s)
> {
>    writefln(s ~ " motherfucker");
> }

An error, since a function call is not a DeclDef.



More information about the Digitalmars-d mailing list