r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • Apr 26 '26
Code Examples From an App Using C++ Modules
https://abuehl.github.io/2026/04/26/code-examples-from-an-app-using-modules.htmlThis demonstrates usage of our recommendations for using modules:
- Prefer small modules
- Only use partitions if you really must
- Avoid using internal partitions
The intention is to show some real code for context of discussions about using C++ modules.
My goal is not to sell modules. If you prefer not using modules: Use header files. There are good reasons to continue using them.
For me, C++ source code is an asset. The intrinsic value of code using modules is higher (lower entropy), as modules are a higher abstraction, compared to header files, which are basically just the pasting of C++ code into translation units (I've done that for ~36 years now).
Using C++ modules comes at a cost though. Understanding modules requires a certain level of understanding, which isn't needed when using the simple model and tradition of header files.
View all comments
Show parent comment
1
u/not_a_novel_account cmake dev Apr 27 '26
Nothing in
stdcollides with anything else in namespacestd.You can include every
stdheader without any collisions.This is why
import stdworks at all.If we had different headers which provided different
std::maptemplates that would be very bad and I would be forced to agree with you. That is not the case instdand will inevitably cause link errors in any library which tries with its own namespace.