News for hackers. Stuff that matters.
Re:Trying out C++20's modules with Clang and Make by trealira on Sunday October 15, 2023 @06:21PM (#37893933)
>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.

Ah, I didn't realize, my bad.

Re:Trying out C++20's modules with Clang and Make by maccard on Sunday October 15, 2023 @06:43PM (#37894084)
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.