Why typeof(template) is void?
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 19 18:50:37 PDT 2016
On Wednesday, 20 July 2016 at 01:14:05 UTC, mogu wrote:
> Why S's type isn't something like `S: (T) -> S`?
Because S isn't a type... think of a template as being like a
function that returns a type.
int foo(int) { return 0; }
There, you wouldn't expect typeof(foo) to be int, no, typeof(foo)
is a function that returns an int.
The template is the same thing - it isn't a type, it is a
template that returns a type.
More information about the Digitalmars-d-learn
mailing list