Boost logo

Boost :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2024-07-07 10:16:17


On 06/07/2024 13:20, Antony Polukhin via Boost wrote:
> Hi,
>
> C++20 modules seem to be a good tool to improve compile times and to hide
> the implementation details of the libraries.
>
> I've been looking throught the sources of {fmt} library. Looks like the fmt
> library approach to C++20 modularization seems to fit Boost quite well.
>
> How about adding the following macro to Boost:
> * BOOST_BEGIN_MODULE_EXPORT - starts the scope of things to export if Boost
> is build as a C++20 module
> * BOOST_END_MODULE_EXPORT - ends the scope of things to export if Boost is
> build as a C++20 module
> * BOOST_MODULE_EXPORT - for a single entity export if Boost is build as a
> C++20 module

I can't see all of Boost as one module - honestly I think at present
that's a terrible idea - even if it were actually possible with current
compiler technology.

IMO this is more likely to be done on a library by library basis, with
the module source files defining BOOST_MYLIB_EXPORT (or whatever).

Note that it's pretty trivial to define higher level groupings of modules:

export module stuff_from_boost;

export import boost.A;

export import boost.B;

// etc

We do need to add BOOST_NO_CXX20_MODULES and BOOST_NO_CXX23_STD_MODULE
though (the latter in particular is supported by msvc even though it
does not define the relevant std feature test macro).

And yes, Boost should experiment with some bleeding edge once more.

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk