How about a special null template parameter?

Engine Machine via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 19 14:47:02 PDT 2016


On Friday, 19 August 2016 at 19:13:10 UTC, Jack Applegame wrote:
> On Friday, 19 August 2016 at 18:25:06 UTC, Engine Machine wrote:
>> It replaces the current method of having to define a 
>> non-templated class and a templated class.
>>
>> e.g.,
>>
>> class Type
>> {
>>    int x;
>> }
>>
>> class Type(T) : Type
>> {
>>    static if (T is Dog)
>>       int y;
>> }
> What are you talking about? This code doesn't compile. Because 
> you can't define a class and a template with the same name.

It doesn't matter. That is just a defect of D/language.

If it confuses you, call it Type_Special_X, or, if that confuses 
you, call it something else. Don't get caught up in the words old 
padawan.




More information about the Digitalmars-d mailing list