Is this actually supposed to be legal?
David Nadlinger
see at klickverbot.at
Tue Jul 17 05:48:32 PDT 2012
On Tuesday, 17 July 2012 at 05:24:26 UTC, Jonathan M Davis wrote:
> This code strikes me as being a bug:
>
> --------
> class MyBase(T)
> {}
>
> class MySubA : MyBase!MySubA
> {}
>
> class MySubB : MyBase!MySubB
> {}
>
> void main()
> {}
> --------
This pattern is actually quite common in C++ code, and referred
to as CRTP (curiously recurring template pattern). If you propose
to kill it, Andrei is going to get mad at you. ;)
David
More information about the Digitalmars-d-learn
mailing list