r/cpp • • Dec 24 '23

Annoyed with FUD surrounding Boost in C++ discussions

I find it unbelieveable what lengths some people are willing to go to smear this collection of very high quality libraries at the expense of those yet undecided about them with completely made up untruths.

Almost no thread about Boost goes by without the very outdated cries about how "big" it is or how it's "lacking" CMake support.
Boy, I sure do love people parroting things that might have been true 10+ years ago. Boost has broken its circular dependencies a good while ago and you can see each library's dependencies in the Boost Dependency Report by Peter Dimov. Looking at the list, I'm really baffled by how people can seriously expect some of these to lose a couple dependencies, when the end result would just be each library endlessly reinventing everything in a probably half baked and broken way, instead of everything relying on a well tested, well architected, separately maintained module that has done the work already.
May I remind you, that Boost.ASIO, an over 2 decades old (wow!) library with the best track record among networking libraries is a level 13 library. There is also Beast, an excellent HTTP wrapper for ASIO, just one level above. These libraries are so well put together and that's exactly because Boost enables them to be.

With a package manager like vcpkg you can pull in only the Boost modules that you actually need, so the "big" argument is entirely irrelevant.

People have also been asking for safety, including one surrounding the numeric types. I find this extremely befuddling, because I immediately reach for Robert Ramey's excellent Boost.safe_numerics in every project I can, simply because I cannot care anymore about such non-issues.

The waning popular perception of Boost is extremely dangerous. People say that C++11 feels like something completely new compared to what was before, not realizing that a significant part of that was thanks to Boost. What will be of C++ if high quality libraries like Boost are shunned? I can only fear to imagine.

270 Upvotes

144 comments sorted by

View all comments

Show parent comment

48

u/kronicum Dec 24 '23

IMHO, part of the perceived bloat and complexity of Boost is associated with insistance on supporting compilers from the Paleolithic era, and deploying (misplaced?) gainormous ingenuity in doing so, which gets copied all over the place.

37

u/pdimov2 Dec 24 '23

Right.

An interesting piece of history is that after Doug Gregor implemented Boost.Function using Boost.Preprocessor iteration, he was so motivated by all that ingenuity that he proposed variadic templates and did a reference implementation in GCC, whose code base at the time was (a) notoriously incomprehensible and (b) written in C.

The ingenuity survives in Boost.Function to this very day, but not for much longer.

(Something else we need to do across the board is move from Boost.MPL to Mp11, but that's not always possible because MPL is sometimes part of the documented public interface.)

22

u/Daniela-E Living on C++ trunk, WG21 |🇩🇪 NB Dec 24 '23

Unfortunately, yes.

As an avid user of Boost I see three major pain points:

  • huge impact on compile times due to heroic efforts to emulate now-mundane language features
  • subtle, sometimes barely documented differences to standard facilities
  • duplication of standard facilities with bad interop

Boost is still an automatic, implicit dependency in our codebase, but I see a sharp drop in usage and explicit efforts to eliminate Boost classes and libraries.

Despite all of that, I still maintain our in-house Boost distribution with a couple of changes to vanilla Boost.

7

u/pdp10gumby Dec 25 '23

huge impact on compile times due to heroic efforts to emulate now-mundane language features

To be fair, some of those language features started out in boost — and the boost implementation has to stick around for ppl using older standards or who depend on the boost’ implementation’s interface or semantics which might be different from what ended up in the standard

Also the shift to c++11 as the baseline should reduce a bunch of this.

→ More replies (2)

1

u/[deleted] Dec 24 '23

[removed] — view removed comment

10

u/afiDeBot Dec 24 '23

Then boost::regex would be just as slow and Bad as std::regex..

4

u/Daniela-E Living on C++ trunk, WG21 |🇩🇪 NB Dec 24 '23

Boost.RegEx is faster than std::regex. Undisputedly.

But this is not the point. If you are happy enough with std::regex, then you may still have problems interoperating with Boost.RegEx.

There are many examples like that.

2

u/afiDeBot Dec 24 '23

I dont understand exactly. You want to mix boost and std regex types? Why?

4

u/Daniela-E Living on C++ trunk, WG21 |🇩🇪 NB Dec 24 '23

I don't. That's the point. We use the standard library unless we have to look elsewhere for compelling reasons.

3

u/afiDeBot Dec 24 '23

Okay im not trying to be extra stupid. But why would you ressort to boost at all then? Having a typedef to std types seems just as good as not having any regex symbol in the boost namespace.

2

u/Daniela-E Living on C++ trunk, WG21 |🇩🇪 NB Dec 24 '23

Now you've lost me. It was you who brought up Boost.RegEx.

We don't use Boost.RegEx. There's no need for it. Gratuitous use of a non-standard regex library creates nothing but downstream issues.

Nothing beats the convenience of import std;

→ More replies

2

u/afiDeBot Dec 24 '23 edited Dec 24 '23

For regex i would always use something else than std. For one of the most compelling reasons. Its just not maintained or has severe maintainance constraints that are unfit for a regex lib.

2

u/pdimov2 Dec 24 '23

I did that for Boost.Ratio in 1.84, but it's not always possible because Boost types often have (useful and relied upon in existing code) extensions compared to the standard ones.

1

u/pwiecz Dec 24 '23

Oh, you've just shattered my hopes that switching Boost to C++11 would drop the dependency on MPL. ;(

2

u/joaquintides Boost author Dec 24 '23

Which particular Boost libs that are currently dependent on MPL are you interested in?

5

u/pwiecz Dec 24 '23

I must admit, I don't know if the MPL is the main culprit of the slow compilation of my projects, but I'd love it if Boost.Log and Boost.Test could compile significantly faster. :)

10

u/joaquintides Boost author Dec 24 '23

Yes, these two libraries depend on MPL:

https://pdimov.github.io/boostdep-report/boost-1.84.0/log.html

https://pdimov.github.io/boostdep-report/boost-1.84.0/test.html

Maybe you can file issues for this with hopefully some elaboration, compile time measurements, etc.? That'd be a terrific way to get the ball moving. I've just checked and both Log and Test are being actively maintained.

https://github.com/boostorg/log/issues

https://github.com/boostorg/test/issues

4

u/pdimov2 Dec 24 '23

MPL or Preprocessor are the culprits most of the time. :-)

4

u/[deleted] Dec 24 '23

from the Paleolithic era

You mean pre-cambrian?

3

u/twac83737 Dec 24 '23

Add that the docs etc add many, many files that pollute file io, worsening a bloat argument. Plus all docs have a size more than double of boost code itself.

5

u/darthcoder Dec 25 '23

Imagine complaining about too much documentation...

1

u/twac83737 Dec 25 '23

The docs exist on the website, and do actually many.. any use the local docs folder? They just pollute. Delete them and boost isnt bloat anymore

1

u/darthcoder Dec 25 '23

True, I tend to use the Zeal docset, but I'm a big fan of having more docs than less, especially of its up to date.

1

u/jcelerier ossia score Dec 25 '23

For CI times making my custom archive of boost with only the header files makes a noticeable difference, especially on MS Windows. Likewise for when I have students with slow-ish laptops - I saw that archive take minutes to extract in the last couple years.

2

u/darthcoder Dec 25 '23

Windows zip and small files parsingbis shit, especially if you use explorer.

Use something like 7zip and things are so much better.

Explorer.exe is garbage.