>Extern templates have existed since c++11 for that.
True, but ar least you don't need to write extern template class SomeTemplateClass<SomeType> in the header, and then explicitly instantiate it in the source. You can just write "export template class SomeTemplateClass<typename T> { ... };" (i.e., "export" followed by the definition) in the module file.
> Modules are compiler specific too, unfortunately.
We have a handful of expensive, widely used templates in my work project.
We put the extern definition in a precompiled header and we have an externals.cpp file. It works a treat.
> Ah, I didn't realize, my bad.
Yeah, a huge beat was missed here. I don't envy the compiler writers, but surely we could have spent 6 months out of the last 19 years defining a common format, even if it defined <implementatiom defined blob> for the meat of the work.
True, but ar least you don't need to write extern template class SomeTemplateClass<SomeType> in the header, and then explicitly instantiate it in the source. You can just write "export template class SomeTemplateClass<typename T> { ... };" (i.e., "export" followed by the definition) in the module file.
> Modules are compiler specific too, unfortunately.
Ah, I didn't realize, my bad.