Community

This was originally on comp.lang.c++.moderated:
"Robert Kindred" <RKindred@SwRI.edu> wrote in message
news:116a3fter9qeq07@corp.supernews.com...
> I know of no other language [besides C++] capable of the Curiously
> Recurring Template Pattern (Leda does not count).
Here's the wiki entry on the CRTP:
http://c2.com/cgi/wiki?CuriouslyRecurringTemplate
and the D Programming Language implementation of it:
class ArithmeticType(T)
{
T opAdd(T other)
{
T result = new T(this);
result += other;
return result;
}
}
class Quaternion: ArithmeticType!(Quaternion)
{
this() { }
this(ArithmeticType!(Quaternion) t) { }
Quaternion opAddAssign(Quaternion other)
{
// etc.
}
}
So now there are two languages that can do the CRTP <g>.