How about a special null template parameter?

Meta via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 22 08:58:14 PDT 2016


On Sunday, 21 August 2016 at 21:21:22 UTC, Engine Machine wrote:
> Well, I see that a template with 0 parameters can act as a 
> "type", if you will.
>
> Just like functions
>
> void foo(T)(T x)
>
> acts like a normal function foo(3) even though it is a 
> templated function.
>
> In fact, I see very little difference between a template with 0 
> parameters and a type.
>
> Type!() = Type

I think this is a very bad idea theory-wise, if not in practice 
as well. A template is a type constructor, not a type. They are 
two very different things. You can get the size of a type, its 
members, etc. while you cannot for a template.




More information about the Digitalmars-d mailing list