Boost logo

Boost :

From: Ivan Matek (libbooze_at_[hidden])
Date: 2024-12-16 15:08:42


On Mon, Dec 16, 2024 at 12:41 PM Andrey Semashev via Boost <
boost_at_[hidden]> wrote:

> Adding find() overloads to containers means adding a dependency on
> boost::optional, which makes the container a more heavy dependency for
> the users. Since containers are often used as data members in classes,
> this increase in source code footprint arguably will be fairly visible
> across user's code base.
>

Did a quick experiment on my machine:
//#include <boost/optional.hpp>
#include <boost/unordered/unordered_flat_map.hpp>

int main() {
}

110k LOC after preprocessing(libstdc++)
90k LOC after preprocessing(libc++)

#include <boost/optional.hpp>
#include <boost/unordered/unordered_flat_map.hpp>
int main() {
}

114k LOC after preprocessing(libstdc++)
94k LOC after preprocessing(libc++)

So it seems that almost all the stuff that optional drags in is anyway
dragged in by unordered_flat_map.hpp

P.S. I know counting LOC is lame way to estimate compile speed, but it is
best one I know without finding some large codebase and trying to add
optional header to all places where unordered_flat_map is used.
On my machine compile time difference when adding optional header is tiny.

Different containers from boost might have different includes, so this may
not apply to them.


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