Why do std.traits use template foo(args...) instead of foo(alias arg) ?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 18 08:26:20 PST 2014


On 12/18/14 11:21 AM, ketmar via Digitalmars-d-learn wrote:
> On Thu, 18 Dec 2014 15:52:06 +0000
> Low Functioning via Digitalmars-d-learn
> <digitalmars-d-learn at puremagic.com> wrote:
>
>> On Thursday, 18 December 2014 at 15:48:02 UTC, Mathias LANG wrote:
>>> An exemple being fullyQualifiedName:
>>> https://github.com/D-Programming-Language/phobos/blob/master/std/traits..d#L415
>>>
>>> I don't get this pattern. Is it documented somewhere ?
>>
>> http://dlang.org/variadic-function-templates.html
> that's not a question about "what it does?", but the question about
> "why it did this way?"
>
> the answer is simple: `alias` arguments can't accept types. i.e.

s/types/keywords

alias can accept types as long as they are symbols.

For instance:

struct S {}

pragma(msg, t1!S); // works.

-Steve


More information about the Digitalmars-d-learn mailing list