Understanding C++ Module Units
abuehl.github.io·12w·
Discuss: r/cpp

C++ modules again! Do you use them? We’re using them for our UML Editor (Windows, MSVC).

At first glance, C++ modules look like they are easy to understand. After all, we all have been used to use header files for decades now, it can’t possibly be more difficult than header files, can it?

Yes, it can!

C++ modules are nice, but there are… footguns!

Let’s have a closer look at the C++ module basics again. As professionals, we really need to fully understand what we do. So, please, carefully read on.

In C++20 (and later) we can define a primary module interface unit using the keywords export module.

Here is an example (file A-interface.ixx):

export module A;

namespace A
{

export int f(i...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help