CRTP in D?

Bill Baxter wbaxter at gmail.com
Wed Aug 19 15:00:07 PDT 2009


On Wed, Aug 19, 2009 at 2:59 PM, Saaa<empty at needmail.com> wrote:
>
>> Mixins can be used to do a lot (most? all?) of things CRTP is used for:
>>
>> class Class(alias MixMe)
>> {
>>   mixin MixMe impl;
>>   ...
>>   void doSomething {
>>         impl.doIt();
>>   }
>> }
>>
>
> where can I read about class parameters?

It's just a class template.  Short for

template Class(alias MixMe)  {
  class Class {
      ....
  }
}

See http://www.digitalmars.com/d/2.0/template.html under "Class Templates".

--bb


More information about the Digitalmars-d-learn mailing list