CRTP in D?

bearophile bearophileHUGS at lycos.com
Wed Aug 19 14:22:05 PDT 2009


div0:

> Mixins do pretty much same thing but in reverse, mixins pull stuff right
> into the class, and with a mixin it's the class which is imposing the
> meta interface on the mixin.
> 
> As you pointed out though, CRTP nukes your inheritance slot in D, so
> you'd generally prefer mixins in D. CRTP isn't going to give you any
> advantage that I can see, you just have to do your design the other way
> round than you would in c++.

Thank you to all the people that have answered me.
Mixins have an advantage: I have understood them in minutes and then I have used them. While I haven't undertood CRTP that quickly :-)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list