logoalt Hacker News

jjmarrtoday at 1:08 AM1 replyview on HN

You're not supposed to distribute the precompiled module file. You are supposed to distribute the source code of the module.

Header-only projects are the best to convert to modules because you can put the implementation of a module in a "private module fragment" in that same file and make it invisible to users.

That prevents the compile-time bloat many header-only dependencies add. It also avoids distributing a `.cpp` file that has to be compiled and linked separately, which is why so many projects are header-only.


Replies

dupedtoday at 1:13 AM

What I mean is, I have yet to see projects in the wild _use modules at all_.

show 1 reply