Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2023-10-01 11:05:18


Andrzej Krzemienski wrote:
> Hi Everyone,
> I would like to get the community's advice on removing the support for
> InPlaceFactory from Boost.Optional.
>
> The motivation for this is to reduce dependencies among Boost libraries.
> Boost.Optional is surprisingly heavy. This is mostly due to the dependency
> on InPlaceFactory and OptionalPointee from Boost.Utility.
>
> https://pdimov.github.io/boostdep-report/develop/module-weights.html#weight:12
>
> InPlaceFactory (
> https://www.boost.org/doc/libs/1_83_0/libs/utility/doc/html/utility/utilities/in_place_factory.html)
> used to be a workaround for the missing "perfect forwarding" in C++03, it
> emulated both "universal references" and variadic templates. It is
> unnecessary for C++11 where Boost.optional offers a superior interface. But
> removing the support for InPlaceFactory would break code for people that
> happen to use it. When the user switches to C++11 (C++03 support is
> deprecated for Boost.Optional) they should expect their programs to still
> compile. But if I remove the InPlaceFactory, it forces the users to change
> their code, even if they are already on C++11.
>
> Can InPlaceFactory be moved to a separate library? Or is it so useless now
> that it has to be eradicated even at the cost of breaking users' code?

Can you not just forward-declare the two base classes
boost::in_place_factory_base and boost::typed_in_place_factory_base?


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