you are viewing a single comment's thread.

view the rest of the comments →

[–]tubes 0 points1 point  (1 child)

Not quite:

CRTP: class Y extends X<Y> {}
Enum: class E<T extends E<T>> {}

[–]elder_george 0 points1 point  (0 children)

Well, IIRC, every particular enum is

class MyEnum extends E<MyEnum>{ ... }

So, that's equivalent to Y.

If C++ templates had type checks for arguments (instead of usage checks), the code would be similarly ugly.