Can't declare a "template parameter which takes anything"

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Mon Mar 17 09:30:13 PDT 2008


On Mon, 17 Mar 2008, Steven Schveighoffer wrote:

> "Russell Lewis" wrote
>> I'd like to propose that we need a template parameter syntax which means
>> "this parameter can be anything...type, alias, or value."  Currently, an
>> unadorned parameter is required to be a type, and it cannot take an alias
>> or value parameter.
>
>
> Have you tried alias parameters?
>
> template template_foreach(alias T)
> ...
>
> This allows any symbol to be given
> (http://www.digitalmars.com/d/1.0/template.html#TemplateAliasParameter) I'm
> not sure if it works for literals though.

It doesn't match types (unless they have a symbol, e.g. typedefs have) or 
values (except blocks and possibly some other special cases).



More information about the Digitalmars-d mailing list