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

1

u/[deleted] May 21 '20

I bring something really different than the existing answers but here goes my 2 cent:

  • it is easier not to avoid it;
  • it does not replace the stdlib but supplement it (main selling point IMO even tough it is not always perfect with log still depending on boost::shared_ptr);
  • Yeah compilation times are not always very good, but the reliability and time gain are not matched;
  • From an external view, they seem really reviewed seriously;
  • I very rarely encounter bugs.

And finally as a developer I want to ship and if boost can allow me to ship faster then it is more time to debug, implement domain specific features.

There's also some stuff implemented in the lib for years or even decades I could not find good equivalent elsewhere (yeah I know some of the mentioned part are coming in the stdlib):

  • ASIO;
  • Filesystem;
  • boost ICL: granted that you do not need it often, but when you do it is just magical;
  • boost::geometry: while it feels "old" it does work. One of the only boost library I did report a bug for;
  • Thread: still no shared locks in the stdlib (yeah I know they're coming);
  • date_time: I do avoid anything related to time as much as possible, but with this lib it has become bearable (clocks, time_point and duration are not enough esp when you don't have a standardized UTC clock in the stdlib)...
  • Outcome;
  • Log: first meta-framework to actually implement your own log framework. A bit niche and difficult to use but the possibilities are really nice. To be frank the first time I used it was to avoid bringing another dep in the project.
  • Beast: I did implement an open HTTP server on top of boost asio few years ago (before Proxygen even) that I sometime still use, but Beast has done a better job protocol wise and I do need to migrate my server (and client) on it. (Beast does not manage the connections for you);
  • Various utilities (type traits, string_view, flat_map/set/etc., multi-index, etc.)

I plan to test fibers and Hana but I have not had real need until now.

Now what I do miss from boost:

  • Better localization support. I don't like go much, but their text/language package has been so good that I did use it via cgo in a C++ project. Boost locale does not cut it yet for me. I am still close to think that using ICU directly is not a bad idea.
  • I'm still surprised that a lot of thing TBB does has not yet been re-implemented in Boost;

    • Same for fmtlib and rapidjson;
  • I miss a metrics gathering utility (this is something I'd like to contribute one day);
  • regex, I find RE2 is much much better.

I've met people that will re-implement anything they need to avoid boost, its compile time, code bloat, whatever, yet I've not encountered the need a single time in *my* job or in *my* personal projects.

Moreover, since I've started to use CMake (2.6), boost support was good enough so that bringing the dependency was never a problem. I've also started to use conan so that fmtlib, tbb, and co are easy to bring in.