std.traits.ParameterIdentifierTuple bug or not?
Dicebot
public at dicebot.lv
Thu Nov 7 10:51:52 PST 2013
On Thursday, 7 November 2013 at 18:39:44 UTC, Uranuz wrote:
> Thanks a lot! Seems that I still don't understand where and for
> what alias is needed and this is may be why I avoid of it's
> usage in template parameters. Can you clear for me base cases
> where alias is essential in template parameters?
Refer to complete list of valid template parameters :
http://dlang.org/template.html#TemplateParameterList (including
http://dlang.org/template.html#TemplateAliasParameter)
Point of template alias parameter is to capture references to
symbols (declarations). For example in this example:
```
void foo1(double param) {}
void foo2(double param) {}
```
..both functions have the same type
(http://dlang.org/template.html#TemplateTypeParameter), but are
two different and distinct symbols. You use template alias
parameter when you need to inspect some property of a symbol -
name, parameter names, attached attributes, parent module etc.
Also template alias parameters, contrary to normal aliases, do
accept literals, including lambda literals. This is extensively
used in std.algorithm, you can refer to its source code for
examples.
Ali has pretty much covered it in his book in "more templates"
chapter : http://ddili.org/ders/d.en/templates_more.html
More information about the Digitalmars-d
mailing list