.. ot-topic:: cxx11.new_language_features.modules .. include:: Modules ======= .. contents:: :local: * ODR by design * module name: ``export module MODULE-NAME;`` * export ... symbols * import MODULE-NAME; * macros defined in a modules do not leak to the importer * macros defined before import do not leak into the imported module * can be * separated in two files (just like .h and .cpp) ``export void foo();`` .mpp ``void foo() { return; }`` * or put in the same file (just like everything inline in .h) ``export void foo() { return; }`` * *Module interface unit* * Compilation gives (compiler specific) internal representation * Much like the venerable "precompiled headers" * Large speedup * Compiler not anymore needed for traversal * Can be done by any script * |longrightarrow| tooling * |longrightarrow| interfacing with other languages, without having to do ``extern "C"`` hacks Links ----- * `C++ Modules: Year 2021 (Gabriel Dos Reis) `__ .. raw:: html * `Practical C++ Modules - Boris Kolpackov - CppCon 2019 `__ .. raw:: html * `Implementing C++ Modules: Lessons Learned, Lessons Abandoned - (Old Version) `__ .. raw:: html