top | item 40405190

(no title)

Yotsugi | 1 year ago

I don't undestand why there's still no solution for this in STL. Surely compilers like GCC could support a setup where STL instantiations are cached somewhere? If it was just one extra compile flag telling compiler to cache all template instantiations in some directory however it pleases, that would solve more than STL problems.

discuss

order

mattnewport|1 year ago

Modules, standardised in C++20, are the official solution both for the standard library and for other code but they are not universally well supported by all major compilers and build systems yet.

Transitioning existing code to use modules is also not entirely straightforward, though probably no more problematic than introducing unity builds.

forrestthewoods|1 year ago

> though probably no more problematic than introducing unity builds.

A "Unity build" really just means typing #include "foo.cpp" a few times. It's trivial.

Meanwhile, neither Clang nor GCC support standard library modules. They have only partial support for modules themselves. C++ module support is non-existent in almost all build systems. https://en.cppreference.com/w/cpp/compiler_support

The idea of C++ modules is great. It's badly needed. In practice I'm not sure if they're ever going to be genuinely functional and widespread. Which makes me sad. Toy projects don't count.