Module partitions can be tricky to use. How tricky do they need to be?

14 hours ago 6

Which code example would you prefer? (If you could choose...)

Example A

// file bar.cppm export module foo:bar; ... // file bar1.cpp module foo:bar.impl1; import :bar; ... // file bar2.cpp module foo:bar.impl2; import :bar; ...

Note: Neither foo:bar.impl1 nor foo:bar.impl2 are imported anywhere, so generating a BMI file for these is pointless.

Example B

// file bar.ixx export module foo:bar; ... // file bar1.cpp module foo:bar; ... // file bar2.cpp module foo:bar; ...

Example A is what is currently supported by the C++ standard.

Example B is what is possible using the current implementation of the Microsoft C++ compiler (not yet in the standard).

Both variants achieve the same goal.

Which version do you think is easier to understand?

Previous related posts:

submitted by /u/tartaruga232 to r/cpp
[link] [comments]
Read Entire Article