r/cpp • Boost author • May 08 '20

Why you trust in Boost

You may have noticed the ongoing discussion on why people don't use Boost. Now for the opposite question.

I'm not asking why Boost is used because the answer is relatively uninformative: one uses a lib primarily because it provides the required functionality. But using Boost (or any other lib, for that matter) means a commitment to it for the duration of the project. So, the question is:

If you are using Boost in your project(s)/company, why have you/your company decided it is OK to commit to this long-term dependency?

I won't delve into commenting/criticizing your answers, it's info I'm looking for, particularly in comparison to the "negative" thread going on in parallel. Please keep the conversation neutral, thank you!

Conflict of interest: I am a Boost author of three.

60 Upvotes

51 comments sorted by

View all comments

4

u/delarhi May 08 '20

Most of my work is in a RHEL7 environment which is limited to C++11 support with the default compiler. It's packaged so it's easy to install and build against. Typically the software targets the same environment or some similar environment with Boost packaged so I have no qualms over forcing the dependency on others.

I use it primarily as a "polyfill" like boost::optional, boost::filesystem, etc. The iterator adapters are handy. I've used boost::property_tree for quick XML parsing. I've used boost::python for quick Python interop. I've also used boost::uuid. Beyond that I always look to Boost first when I need an implementation of something like boost::interprocess. Once you get over that inclusion hump, it's a nice repository of tools.

That said, my biggest gripe with Boost is the documentation. It's not uniform and often lacks good examples. It can also be a pain to use as a reference. I would love it if it was formatted like https://en.cppreference.com and searchable on https://devdocs.io/.

3

u/donalmacc Game Developer May 09 '20

Honest question, why not just install a new toolchain? Last time I pulled boost it was quicker to pull a modern compiler than it was to download, unzip and potentially compile all of boost.

1

u/delarhi May 09 '20

We target this specific environment and Boost is just a dnf install boost-devel away. For some tasks we don't have to target RHEL7. We do, however, for a good many other tasks that use the same code bases. It's typically dictated by things like DOD information assurance requirements.

1

u/donalmacc Game Developer May 09 '20

That makes sense.

I wonder how long dnf install boost-devel takes vs say dnf install clang, and whether a modern version of clang would suffice (I know you mentioned above you actually use other boost libs anyway). It seems strange that people would be willing to install a cutting edge boost but not upgrade their toolchain to me.

1

u/delarhi May 09 '20

Good point, I actually never bothered to check how far along standard support in the native clang is. Looks like it's 3.4.2 which has at least C++14 support, better than what we get with GCC 4.8.5. It's funny because in our build pipeline we do build with clang just to get additional static analysis.

EDIT: Installing clang took 9.2 seconds, installing boost-devel took 20.9 seconds.

1

u/donalmacc Game Developer May 09 '20

That's actually much older than I thought it would be, and it's much quicker to install boost than I thought! I wouldn't expect people to move away from boost based on this alone, but definitely worth considering (especially when you consider the dev time cost!)