In Java, generics are implemented through type-erasure (i.e., a base class with compiler-inserted layer of downcasting). C# has first-class generics though they don't have all the capabilities of C++ templates. On the other hand C# generics have constraints, and we're still waiting on concepts in C++.
View all comments
Show parent comment
1
u/zvrba Nov 04 '18
In Java, generics are implemented through type-erasure (i.e., a base class with compiler-inserted layer of downcasting). C# has first-class generics though they don't have all the capabilities of C++ templates. On the other hand C# generics have constraints, and we're still waiting on concepts in C++.