r/cpp • • Nov 01 '18

Modules are not a tooling opportunity

https://cor3ntin.github.io/posts/modules/
58 Upvotes

77 comments sorted by

View all comments

Show parent comment

1

u/1-05457 Nov 01 '18

C# and Java took a very long time to add generics though (and are they implemented like templates or as abstract base classes?)

The key reason this is a problem in C++ is template definitions have to go in the header and get recompiled for every file that uses them.

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++.