Working with modules
Modules are one of the most important changes in the C++20 standard. They represent a fundamental change to the C++ language and the way we write and consume code. Modules are made available in source files that are compiled separately from the translation units that consume them.
Modules provide multiple advantages, especially in comparison to the use of header files:
- They are only imported once, and the order they’re imported in does not matter.
- They do not require splitting interfaces and implementation in different source files, although this is still possible.
- Modules have the potential to reduce compilation time, in some cases significantly. The entities exported from a module are described in a binary file that the compiler can process faster than traditional precompiled headers.
- Moreover, this file can potentially be used to build integrations and interoperability with C++ code from other languages.
In this...