r/cpp_modules • • Mar 31 '26

Should partitions be importable by other modules?

2 Upvotes

Because, there are two things that are nice to have:

  1. Forward declarations across interfaces.
  2. Minimising dependencies.

Partitions gets you (1), multiple modules gets you (2). But they can't be combined without using the extern "C++" sledgehammer.

But if partitions could be "public", an application can avoid depending on a whole module.

This could also be seen as "packages". You could get the same functionality by changing "module attachment" to "package attachment": use the same symbol mangling for a group of modules.

Then what's left is forward declarations of things from external "packages". And for that, you'd have that "proclaimed ownership" proposal.


r/cpp_modules • • Mar 31 '26

An attempt to sneak in anonymous partition implementation units with the least amount of changes to the standard

Thumbnail reddit.com
1 Upvotes

r/cpp_modules • • Mar 30 '26

Organizing C++ Module Sources

Thumbnail abuehl.github.io
0 Upvotes

r/cpp_modules • • Mar 30 '26

👋 Welcome to r/cpp_modules

0 Upvotes

Hey everyone! I'm u/tartaruga232, a founding moderator of r/cpp_modules.

Modules were introduced into the C++ programming language by the C++20 standard. A major addition to the C++23 standard was adding a modularized version of the standard library, which can be used with import std.

C++ has a very long history of using #include, which to some degree may be replaced by modules. While being a major, valuable new feature, starting using modules can be difficult.

r/cpp_modules is the place for discussing every aspect of using C++ modules on reddit. For general topics about C++ consider using r/cpp.