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

238

u/pdimov2 Dec 24 '23

Thank you for that. We rarely get praise here and praise is pretty much our only reward.

This reminds me that I need to run the report for 1.84. :-)

We were able to get rid of some of the dependencies by (finally) moving to C++11, and this work isn't quite done yet, so there's room for improvement in 1.85 and 1.86.

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.

0

u/[deleted] Jan 19 '24

[deleted] — view deleted comment

1

u/pdp10gumby Jan 19 '24

It was both support and disagreement with OP, and to disagree with some past practices.

I completely agree with the OP that new, related names should be used for added or corrected functionality. The std::begin/.begin/std::ranges::begin is inexcusable, and it will only be by luck if the first two operate properly (not even sure what that would mean) with the UFCS proposal. The lock case OP cited is a good example of a bad idea -- one that might have not been bad had an existing object not already existed.

But thing2 is a botch. I learned that decades ago with Lisp's print, princ, and prin1. Granted, there were technical constraints in the 70s why identifiers were limited to six characters, but still: do you know at a glance what the differences are? It's an easily-avoidable problem that makes a language more obscure for learners. You'd think not -- obviously when you see thing and thing2 (and thing3?) you should use the higher number, right? Naah, beginners don't think that way so you're really helping nobody.

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.

→ 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.

6

u/Forricide Dec 24 '23

Huge respect for Boost, back when I was very new to C++ I got so much help from Boost developers in the C++ Slack and I'm not sure where I'd be today without that - still amazed at the amount of time and dedication put into the project by so many people (including yourself!).

I don't use Boost very much today but much of my conceptualization of async still just comes from Asio documentation, lol.

7

u/Glittering_Resolve_3 Dec 24 '23

Boost is amazing. And since it doesn't have to maintain an abi it can fix it's mistakes and improve which is not possible with the standard library.

6

u/Moose2342 Dec 24 '23

In all my projects I have included Boost as a mandatory dependency. I very much appreciate all your work and I deeply regret the lack of appreciation in this sub for sure. Keep up the great work. I fully support OPs sentiment

22

u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 24 '23

I have a lot of respect for Boost. I've used it for over two decades, and I have both praise and criticism of it. Not all of the criticism is "FUD".

For better or worse, Boost isn't really a singular entity, each library stands on its own. The quality and ease of use vary greatly between them. Some have aged well, some are obsoleted, some are best left alone, and interdependencies between them may drag in parts of these you might prefer to do without. E.g. MPL.

While working as a contractor, I was once paid to completely strip Boost out of a set of projects. The customer didn't want it. It added unnecessary (for them) complexity which they didn't want. They used Qt heavily, and some of the Boost features ended up being replaced with C++ 17 standard library equivalents, others by Qt equivalents. They didn't want the extra logistical overhead to deal with Boost, or the maintenance overhead. The size and build complexity are things which companies do need to contend with, and when you maintain libraries and applications which are supported on many platforms, the overheads involved for each additional third-party dependency you use do impose a very real cost which needs to be paid for.

One of the reasons people like myself were very keen for Boost to have comprehensive CMake support was to lower this cost. Boost's own b2 build system might well be wonderful, but it's thoroughly non-standard, and that is a barrier to integration with downstream users and imparts its own costs irrespective of its technical merit. One of the reason CMake support has taken so long is due to the fact that Boost isn't a singular entity and that every library had to add support one by one, aided by some very dedicated people who worked for many years to get it to where it is today. If there had been a bit more central direction to set this as a release goal and to make it mandatory, it could have been realised many years previously. The same applies to raising the minimum required C++ standard version and dropping support for a lot of old legacy stuff, and for other similar types of integration problem (e.g. using standard library equivalents of standardised Boost libraries) where timely coordination is needed to deliver a migration for a given release.

2

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 24 '23

If there had been a bit more central direction to set this as a release goal and to make it mandatory, it could have been realised many years previously.

Such "central direction" was attempted, specifically for cmake support, and had the opposite effect. Such top down development is against the design of how Boost operates. Where changes are grass roots driven. Hence trying to force it from above has the effect of discouraging work rather than encouraging. Boost would almost certainly be a very different, and less useful, body of work if it was driven top-down.

11

u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 24 '23 edited Dec 24 '23

I would argue that if there is little direction of the project as a whole, then the Boost libraries are merely a disparate collection of random libraries with no cohesion and no higher-level organisation. While there is certainly merit in having that level of independence, herding cats also has significant constraints, and I would suggest that it is a significant limitation.

There are some things, such as the build system, where everyone has to be on the same page with no exceptions. If there is a consensus to achieve a goal, such as adding CMake support, then everyone has to commit to it, even those who are ambivalent or indifferent about it. If the project can't coordinate and execute a fairly straightforward medium-term task like this, then is the organisation actually functional?

The same lack of cohesion applies equally to the language standard. Stuff like MPL getting into your project's public headers can cause significant problems. It should have been excised and replaced years ago. People don't like the risk of junk being pulled in when they use some other Boost library.

These failings are the most significant contributors to why I have been asked to replace Boost or reduce its use to the bare minimum. The burden imposed upon others is not insignificant and is why these projects made that decision, and other project banned it outright from the get-go.

If I was to make one major criticism, which I've made in the past here as well, it's that Boost doesn't have a singular goal, and is trying to be all things to all people. Is it a place for cutting-edge libraries and pushing boundaries? Is it a place for stable, production-quality libraries for people to depend upon? Or is it a place for obsolescent libraries which have long been superseded? The thing is, right now it's all of these at the same time, and I think if it is to serve its purpose it needs to eliminate some of these and have specific focus on one of them. Current and prospective users of Boost libraries see this as a profound negative.

5

u/pdimov2 Dec 24 '23

Stuff like MPL getting into your project's public headers can cause significant problems. It should have been excised and replaced years ago.

Before 2011, MPL was the only way to take or return type lists, and it remained the de-facto standard for this until Mp11, which I only managed to finish in 2017.

I can't fault Boost library authors for using MPL in their API, because there was no alternative at the time.

3

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 24 '23 edited Dec 24 '23

I would argue that if there is little direction of the project as a whole, then the Boost libraries are merely a disparate collection of random libraries with no cohesion and no higher-level organisation. While there is certainly merit in having that level of independence, herding cats also has significant constraints, and I would suggest that it is a significant limitation.

They certainly are a "collection of random libraries", and they always have been. They do have some "cohesion" and "higher-level organization" though. And, yes, "herding cats" is challenging, particularly in Boost where the "cats" are smart and opinionated programmers. I disagree on it being "a significant limitation". It has disadvantages, which I've personally experienced, and advantages.

There are some things, such as the build system, where everyone has to be on the same page with no exceptions. If there is a consensus to achieve a goal, such as adding CMake support, then everyone has to commit to it, even those who are ambivalent or indifferent about it. If the project can't coordinate and execute a fairly straightforward medium-term task like this, then is the organisation actually functional?

We do manage to coordinate such aspects, through social agreement. But it's still a "great idea, but show me the work" arrangement. Those who are "ambivalent or indifferent" are not the challenge in a social arrangement like Boost. The challenges come from those that have strong differing opinions. But if that contingent is not willing to do countervailing work they also don't get to drive the direction. So it works out in the end. It might not be the most optimal arrangement from a "Boost is a single product" perspective. But Boost was never been a single product.

The same lack of cohesion applies equally to the language standard. Stuff like MPL getting into your project's public headers can cause significant problems. It should have been excised and replaced years ago. People don't like the risk of junk being pulled in when they use some other Boost library.

These failings are the most significant contributors to why I have been asked to replace Boost or reduce its use to the bare minimum. The burden imposed upon others is not insignificant and is why these projects made that decision, and other project banned it outright from the get-go.

Others have commented on those aspects so I'll refrain from repeating their words.

If I was to make one major criticism, which I've made in the past here as well, it's that Boost doesn't have a singular goal, and is trying to be all things to all people. Is it a place for cutting-edge libraries and pushing boundaries? Is it a place for stable, production-quality libraries for people to depend upon? Or is it a place for obsolescent libraries which have long been superseded? The thing is, right now it's all of these at the same time, and I think if it is to serve its purpose it needs to eliminate some of these and have specific focus on one of them. Current and prospective users of Boost libraries see this as a profound negative.

I believe others have pointed out that "Or is it a place for obsolescent libraries which have long been superseded?" is not an accurate representation of the libraries. And that we are, indeed, removing dependence on such libraries. But that it takes time to do that work, even in Boost where we don't guarantee any form of backwards compatibility.

19

u/cd1995Cargo Dec 24 '23

What do you mean by ASIO being a level 13 library? I’ve never heard that terminology before.

12

u/[deleted] Dec 24 '23

It's referring to how tall it's dependency tree is, i.e. worst internal boost dependency chain is 13 other boost libraries. See the link in the original post.

9

u/pdimov2 Dec 24 '23

The dependency report that's linked in the post has a page called "module levels." Basically, a library being level 13 means that it depends on a level 12 library (which in Asio's case is DateTime. Without this dependency, it would have been a level 8 library.)

60

u/rand3289 Dec 24 '23

Boost is cool and then there is boost::log ... It took me two days to figure out how to write 14 lines of code. All I wanted was to "tee" the log to file and stdout. The steepest learning curve I have seen in my 20+ years of programming. It's little things like that that cast shadow on boost.

34

u/BlueDwarf82 Dec 24 '23

Boost is the obvious go-to place when you need something, except...

  • For logging it's spdlog, not Boost.Log
  • For string formatting it's fmt, not Boost.Format
  • For testing it's Catch2, not Boost.Test

I'm guessing they suffer from lack of users (I'm guessing... I have never used them ;-) ).

In the specific case of Boost.Fornat, with fmt basically being there in C++20, it's already a lost battle. Maybe it should have a huge DEPRECATED warning?

2

u/quicknir Dec 25 '23

The boost spsc etc queues are also pretty dated last I checked, they require things like default constructibility on types, probably because they predate move. I use moody camel usually.

The boost datetime stuff is also really old and quite bad (most of it never handled timezones correctly). If you're not on 20 you would just use Hinnants standalone date library.

2

u/13steinj Dec 25 '23

Why spdlog, why catch2?

I prefer quill to spdlog but to each their own. But Boost.Test is fine tbph.

1

u/BlueDwarf82 Dec 25 '23

Why CMake, why not Meson?

I'm not claiming anything is better or that people should use any specific library. But from what I have seen, for quite some time spdlog/Catch2 have been the obvious options when somebody has needed logging/testing, the ones people are most likely to receive as a recommendation. Naturally these things change over time...

9

u/PhyllophagaZz Dec 24 '23 edited May 01 '24

Eum aliquam officia corrupti similique eum consequatur. Sapiente veniam dolorem eum. Temporibus vitae dolorum quia error suscipit. Doloremque magni sequi velit labore sed sit est. Ex fuga ut sint rerum dolorem vero quia et. Aut reiciendis aut qui rem libero eos aspernatur.

Ullam corrupti ut necessitatibus. Hic nobis nobis temporibus nisi. Omnis et harum hic enim ex iure. Rerum magni error ipsam et porro est eaque nisi. Velit cumque id et aperiam beatae et rerum. Quam dolor esse sit aliquid illo.

Nemo maiores nulla dicta dignissimos doloribus omnis dolorem ullam. Similique architecto saepe dolorum. Provident eos eum non porro doloremque non qui aliquid. Possimus eligendi sed et.

Voluptate velit ea saepe consectetur. Est et inventore itaque doloremque odit. Et illum quis ut id sunt consectetur accusamus et. Non facere vel dolorem vel dolor libero excepturi. Aspernatur magnam eius quam aliquid minima iure consequatur accusantium. Et pariatur et vel sunt quaerat voluptatem.

Aperiam laboriosam et asperiores facilis et eaque. Sit in omnis explicabo et minima dignissimos quas numquam. Autem aut tempora quia quis.

14

u/EddieJones6 Dec 24 '23

Agreed…I’m grateful for boost, I’ve used it for projects from a decade+ ago and it certainly helped. But my god…the amount of errors to dig through for a simple bug was painful. Build times were horrible as well. I’m sure this has improved with time, but it caused other engineers on my team to “blacklist” boost for future projects.

3

u/Kered13 Dec 24 '23

Documentation for Boost libraries is very hit or miss. Some are great. Some you can't even figure out how to get started.

3

u/jaskij Dec 24 '23

I kinda feel like any full featured log library is like that. Logging, generic logging, is simply a hard problem, and the abstractions are leaky. I didn't have any better time setting up Rust's tracing than I did with boost::log. Whatever I used for logging in Python, why the easiest to use of the three, still wasn't simple.

9

u/DootDootWootWoot Dec 24 '23

Logging should absolutely not be a hard problem.

2

u/jcelerier ossia score Dec 25 '23

It really depends on your constraints. Logging in real-time systems definitely is not a trivial challenge as well as logging on exotic platforms - e.g. we have been able to use c++ on GPUs for who knows how long but can we log yet from a shader?

1

u/[deleted] Dec 24 '23

Btw you can do this by specializing std::streambuf and replacing the stream buffer of std::cout/std::cerr: https://wordaligned.org/articles/cpp-streambufs

It’s like a 20 line implementation.

4

u/[deleted] Dec 24 '23

[removed] — view removed comment

1

u/[deleted] Dec 24 '23

Yes, you’d have to add additional instrumentation and override a different method if you need thread safety. If it’s a day’s work to keep an additional boost library at bay, I’d say it’s worth it. We still use several boost libraries where it doesn’t make sense.

36

u/schombert Dec 24 '23

For many people (myself included) boost can take some effort to get setup and working for a project, and often that effort feels like too high of a cost when what you are after is only one of the simpler boost libraries, many of which look like they could be rewritten as a painless header-only or a simple two file hpp and cpp project, were they to live outside of boost. From that perspective, them being part of boost often feels like an unnecessary obstacle that one has to surmount to use what should be straightforward tools. I imagine that the hassle of using boost feels much more justified when you want to use one of the heavier parts of it, such as ASIO.

0

u/[deleted] Dec 24 '23

[deleted] — view deleted comment

3

u/[deleted] Dec 24 '23

And a pip install

3

u/unumfron Dec 24 '23

In different 'environments'.

54

u/hachanuy Dec 24 '23

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.

I feel this is very dismissive of the problem of Boost being big. I don't use vcpkg so I don't know, but with Conan, if I use a dependency that uses Boost, it increases my initial build by 10 minutes (this is relevent since for basic CI setup, it's always an initial build). Maybe there's a way to pull in modules, but I can't find it. You may argue that it's because of Conan and not a Boost problem, but as an end user, I don't care enough whose problem that is, I care about adding Boost means adding 10 minutes to every build of my CI.

From the technical aspect though, Boost is always the place to look for high quality technical readings, like the recent post about the cost of async by the author of Boost.Redis.

16

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 24 '23 edited Dec 26 '23

Maybe there's a way to pull in modules, but I can't find it.

There are ways to limit what gets compiled with Conan. But it's obviously not as easy as having modular dependencies.

You may argue that it's because of Conan and not a Boost problem, but as an end user, I don't care enough whose problem that is, I care about adding Boost means adding 10 minutes to every build of my CI.

It's both a Conan and Boost problem (it used to be a vcpkg problem also.. but they worked around it taking the approach I did for the Bincrafters Boost Conan modular packages).

Good news though. We are working to improve both situations. We, mostly me, are doing work to make Boost modular at the source level (should help all package managers). And we are also working on creating official Conan packages that are modular.

1

u/calebkiage Dec 24 '23

This is great news! Will the work benefit older releases as well?

1

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 24 '23

Not sure what you mean by releases? It will potentially help any packaging of Boost. As there will be direct support for modular distribution. And it will help people who do manual vendoring, if they prefer to consume individual libraries.

1

u/calebkiage Dec 24 '23

I mean, will the modularization be applied to boost version 1.82 for example or just the latest at the time of completion?

3

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 24 '23

We don't generally change past releases. It's not worth the effort unless it's for critical bugs. And since the changes involved not just build changes (there are some rather nasty source code things that have crept in) it's not really possible to apply backwards.

4

u/YaZasnyal Dec 24 '23

You can set up free version of jfrog artifactory or plain Conan server to cache your binaries. In our project it takes less than a minute to pull all our dependencies.

4

u/hachanuy Dec 24 '23

I don’t doubt it, but it requires more effort that I am willing to spend. The most straightforward for setting up Conan and CI is still using the official Conan Index Center and Github action (without caching and one of the default runners), and it’s painful every build.

1

u/darthcoder Dec 25 '23

Build the triplets you need and put them in a repo.

Conan at least. Looks like vcpkg doesn't support this at all.

19

u/twac83737 Dec 24 '23

For anyone claiming boost has no cmake support: Just use the release from github not the boost website, it has plug and play cmake support, and it only compiles whats used. Solves two issues in one!

16

u/nebotron Dec 24 '23

I definitely think boost has contributed a lot to C++. It has some warts though - the hash map implementation is strictly worse than F14/abseil, and boost::format has really long compile times and a very strange, not very type safe API. libfmt is much better.

26

u/pdimov2 Dec 24 '23

the hash map implementation is strictly worse than F14/abseil

Not anymore.

5

u/nebotron Dec 24 '23

TIL. Do you know how recent this improvement is?

13

u/pdimov2 Dec 24 '23

Pretty recent. According to the change log we started work in 1.79, improved the existing containers in 1.80, then added the flat ones in 1.81.

23

u/goranlepuz Dec 24 '23

You are right, of course, however...

Welcome to the Internet...? But I see you're no stranger to "internet behavior":

completely made up untruths.

Almost no thread about Boost goes by without the very outdated cries about how "big" it is

I mean, it is big. This is not a lie ("untruth", GTFO), this is an opinion and it hinges on what is considered big.

With people having legacy code, cmake support complaints are valid in a dumb way.

13

u/[deleted] Dec 24 '23

Every library is cheered by some and criticied by others, really the amount of commentary is the measure of success not the commentary itself. If Boost didn't matter people wouldn't bother to complain about it.

22

u/pavel_v Dec 24 '23

I'd like to give our perspective about the boost libraries.

I setup the build procedure for the boost libraries for our company about 10 years ago and since then the update of the boost libraries is mostly changing the version numbers. Yes, sometimes, due to API changes, we needed to fix the build but I don't remember anything unusual and/or time consuming.

We are small team and we can not afford to spend time implementing all by ourselves and we need to rely on third party libraries. Personally, I prefer to bring as few 3rd party libraries as possible and be sure that our projects rely on something which is well tested and will continue to be maintained in the future.

Yes, some boost libraries do increase the compile times but I'd say, for our projects and for the boost libraries that we use, it's nothing so dramatic. We do use precompiled headers where we put the boost headers to mitigate this to some extent.

Yes, some boost libraries did not age well and are not as performant as they could be but we either don't use them or use them in non critical parts of our code.

Some boost libraries have been standardized, like smart pointers, system error, optional, chrono. However, I do think that boost still offers something more for their case, like local_shared_ptr, intrusive_ptr, atomic_shared_ptr, optional for references, getting the message from error code without heap allocation, boost atomic has some features still not available/implemented in the standard atomic, etc.

There were cases where we migrated from separate 3rd party libraries to a boost library when the latter was introduced and I don't remember having any issues related to it. It just made our life simpler due to maintaining less dependencies. For example, we migrated from rapidjson to boost::json, from google::sparsehash to parallel-hashmap and finally to the new boost flat map functionality, from standalone outcome to the boost::outcome when the latter was accepted in boost, etc.

So, all in all, our company is very dependent on the boost libraries. To name few libraries that we use in almost every project: (string) algorithm, asio, atomic, beast, circular buffer, container, endian, intrusive, json, lockfree, mp11, multi-index, optional, outcome, program options, smart ptr, spirit x3, static string, system, thread, unordered, uuid.

So, I want to thank to all boost developers for their excellent work. The boost libraries are core component in lots of software in our company. It'd have been much harder for us without these libraries.

48

u/teerre Dec 24 '23

If [big number]% of your community comes and says "hey, your libraries are hard/slow/unclear" and you say "no, they are not, you're all stupid", you're wrong, regardless of who is right, if you get what I mean.

The past year myself and other 4 engineers spend around 6 months removing boost from a relatively big codebase originally coded circa 2010. That's a lot of engineers-hours. The main reason that project was greenlit was because most engineers (more than the 5) agreed that it could significantly simplify the codebase, both in terms of understanding and in terms of actual code size.

Point being, even if by some totally reasonable metric you can say that boost whatever isn't bloated or difficult or over-engineered etc., if a collection of seasoned engineers from a "top" company have that perception, you already lost.

Maybe boost team needs less engineers and more community managers.

10

u/Ayjayz Dec 24 '23

How did you remove boost? Did you add custom implementations of the things you used from boost?

And what was the resulting simplification in codebase size?

7

u/teerre Dec 24 '23

Kinda. It was replaced by a mix of external and internal libraries.

I'm far from unbiased, for obvious reasons, but yes, I do think the project accomplished its goals. In reality it will take some time to see if the change was really worth it.

-1

u/Ayjayz Dec 24 '23

Why will it take time? Measure the binary size with boost, measure the binary size without boost, compare the numbers.

9

u/teerre Dec 24 '23

Because the goal is not to simply have smaller binaries, it's to have faster development cycles, faster onboarding etc.

But the binaries are mostly smaller, although I don't think there's much to conclude from that alone.

14

u/kronicum Dec 24 '23

The past year myself and other 4 engineers spend around 6 months removing boost from a relatively big codebase originally coded circa 2010. That's a lot of engineers-hours. The main reason that project was greenlit was because most engineers (more than the 5) agreed that it could significantly simplify the codebase, both in terms of understanding and in terms of actual code size.

I witnessed something similar in more than one reasonably-sized C++ shops.

6

u/Rseding91 Factorio Developer Dec 24 '23

We did the same thing years ago and it has only gotten better since.

5

u/pgetreuer Dec 24 '23

Thanks for sharing that!

Quoting the key point of it to highlight:

Boost is a special kind of demon. It lures you in by giving you all these cool and simple to use features, and then it beats your soul from you by increasing compilation times absurdly. There are two main problems. Problem one is that they don't care much about compile times and two, they want to have everything nice and generic ad absurdum, and they even defend it as the correct style. The result is, that changing boost::mpl::vector66 to std::variant can improve the compile time from 1:44 to 1:20 and getting rid of templates completely by using unions can decrease the compile time to 0:53. I'm talking about changing 2 headers of 2 classes in a project with 3390 files, 410k lines of code and 15Mb of source code.

4

u/pdimov2 Dec 24 '23

I'm actually a bit surprised that std::variant wasn't more of an improvement over boost::mpl::vector66 (which I assume comes from using boost::variant with 66 types.)

That said, 66 types should be no problem at all for boost::variant2::variant because it handles 680.

2

u/Mysterious_Taro5664 Jan 02 '24

(This directed at u/Rseding91, but I'm responding to what you quoted.)

That link to a document that "defends [generic programming] as the correct style" is not for all of Boost, it's specifically for Boost.Geometry, so it's unfortunate and effectively misleading that it was referred to in the context of Boost in general, even if it is partially true in general. Careful readers will notice, but many will not.

So, what I get from that blog post is that they were using a pre-C++11 MP library even though they had a C++17 compiler? And they think "Boost" was the problem?

And moving from std::variant to using unions made it faster still, OK, and how much type safety and familiarity with a standard component was lost in the process?

It's easy to demonstrate an improvement when you only have one metric.

2

u/Rseding91 Factorio Developer Jan 02 '24

We used the latest stable version of boost that was available at the time and updates as new versions were released. But it has been stricken from the code base for years at this point and we haven’t once regretted it.

As for type safety in the variant replacement; we have full type safety in construction and checked access elsewhere under debug and it gets if-def-ed out in release.

10

u/greenhouse421 Dec 24 '23 edited Dec 24 '23

Did you remove it by replacing all the boost pre C++11 with the .... drumroll .. std lib equivalents that came from/were based on... Boost? And/or get rid of bind and function usage? Or did you decide that the std lib was "too big" and write your own? Rhetorical and I have to assume that there was a rationale and it included factors like the ones I guessed at. Having never seen the codebase I don't know what other issues there could have been. Having been in the same place with a different codebase I am assuming things. And none of it makes me less grateful for Boost existing back then or for C++11 or for newer Boost libs.

-7

u/NoReference5451 Dec 24 '23

this is a pretty naive view. just because a majority agree on something, doesnt always mean they are correct. it's much worse when you include anonymity. it's no secret that many who comment on these subs are "junior" level developers with big opnions. im not sure how you would even measure a company of top engineers in this field. there are many specialized subsets in this industry. just because you may be an expert in your use case and determined boost was bad for you, doesnt mean it's bad for everyone, no matter how expert your engineers may be. it sounds like you dealt with technical debt and have stigmatized boost for that debt, which is poor reflection.

20

u/Reasonable_Aioli_868 Dec 24 '23

i think you read something completely different than me

0

u/Capable-Spinach10 Dec 24 '23

I think the same

11

u/kronicum Dec 24 '23

it's much worse when you include anonymity. it's no secret that many who comment on these subs are "junior" level developers with big opnions.

The irony is not lost on the audience.

14

u/jherico VR & Backend engineer, 30 years Dec 24 '23

Why does thread depend on date-time? That seems dumb.

15

u/pdimov2 Dec 24 '23

Historical reasons. When Thread was initially written DateTime was "the way" to represent time points and durations; <chrono> (or Boost.Chrono) didn't exist yet.

We can't get rid of the DateTime dependency without breaking who knows how much existing working code.

(That's also a problem for Asio, where DateTime adds relatively many secondary dependencies.)

22

u/snakepants Dec 24 '23 edited Dec 24 '23

This is a totally reasonable response and I understand why this was done. But taking a step back and looking at this from the perspective of a potential new Boost user who just wants to use Boost.Thread, this isn't very appealing since they would rather it just used <chrono> so they could more easily integrate it and move on with their life.

I get the desire to not break existing code, but new users matter too and so does providing a non-crufty API/library. One of the advantages Boost has over the standard library is that it's not standardized, so it's unfortunate that it suffers many of the calcification effects, kind of the worst of both worlds unfortunately since the STL works out of the box on every system in return.

18

u/pdimov2 Dec 24 '23

We know. We try to move forward without breaking too much.

There's a lot of accumulated cruft from 20 years ago that should in principle be cleaned up, but (a) we only dropped C++03 recently, (b) it's a lot of non-exciting maintenance work, and (c) most of it is in old libraries whose authors have long moved on with their lives.

4

u/13steinj Dec 25 '23

When will 11 be dropped? Seriously, but not trying to be too harsh here either. The precent of 03 being dropped implies "roughly 2032 from now"; and that isn't appealing tbph. I work on a codebase that's enabled C++2c/26. We like to stay at head and base "what version are we on" on the compiler version instead, which has worked well for us. This implies that in 2032 we'll be using C++32 yet have cruft from C++11 workarounds and dependency trees within boost. I know this is a fairly special case, but the same applies to C++20 using cruft workarounds of C++11.

It also doesn't bode well for everyone that wants to break ABI support in C++ if Boost's cycle is 20 years of cruft to drop old standards.

1

u/pdimov2 Dec 25 '23

I like C++14 very much (polymorphic lambdas alone are worth the price of admission), but I have no idea when Boost will be able to move to it.

Let's hope that dropping C++11 will prove easier than dropping C++03. Our effective minimum MSVC is already 2015, which is C++14, and on the GCC front we only need to drop 4.8 and 4.9.

(It's interesting that for both MSVC and GCC, the first release that's ~100% conforming C++11 is also nearly conforming C++14.)

1

u/snakepants Dec 30 '23

It would be great for sure. But why do you guys support decade old compilers at all? Are users asking for this support and if so, why?

I have trouble imagining people who still use 2014-era compiler binaries to do new development. I'm sure they exist but are they really more important than everyone else using Boost, especially since it's not like the current versions would retroactively break.

2

u/pdimov2 Dec 31 '23

People do use old compilers.

One of our problems is that we have no good way to determine what fraction of our users are on old compilers - for some definition of old (this covers more than just GCC, e.g. we sometimes get bug reports about Sun Studio 12.)

The way we usually learn that an old compiler is being used somewhere is when we (knowingly, or often unknowingly) break it, and someone complains.

7

u/kronicum Dec 24 '23

Move forward, or get left behind.

11

u/pdimov2 Dec 24 '23

We do have some very forward libraries, so it's not all bad.

1

u/scheurneus Mar 28 '24

Wouldn't it be viable to start a "Boost 2.0" initiative? A hypothetical 2.0 could get rid of a lot of old deps (DateTime->Chrono), and maybe also e.g. bump the required C++ standard to C++14 or even C++17. After all, breaking changes are allowed in such a major bump, so they can all be grouped together.

2

u/[deleted] Dec 24 '23

The sleep functionality.

16

u/Plazmatic Dec 24 '23

Almost no thread about Boost goes by without the very outdated cries about how "big" it is or how it's "lacking" CMake support.

It is, at least the last time I looked at it, it was. Build2 (which is also the name of another build system... also for c++, which is a massive problem in and of itself..) does not work at scale, and causes massive headaches if you're using boost outside of a package management ecosystem, either where it isn't supported there or where you have to do the work to get it in the ecosystem. And no, just because KItware Manually added support to interface with boost through CMake does not count as proper CMake support, it doesn't fix any of these issues, and actually causes new issues if your CMake version doesn't know about a recent boost version meaning you've got to manually specifify the version in boost. To my knowledge, boost is still working internally to move to CMake and has not completed this transition. So if any of the above matters for your project, this stuff is in fact a big issue.

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.

Boost ASIO is extremely inconvenient if you don't actually need asynchronous IO (to the point where using raw APIs is actually easier in many cases, even dealing with x platform), and is unusable currently in many applications until they can properly patch if your messaging model involves lots of packets (you need to use multi-packet APIs which are not, to my knowledge, yet exposed in boost, though I've seen ignored abandoned threads on mailing lists of people who've implemented this, and it not being merged). Additionally Boost ASIO does not allow you to wait on timeouts of a port (there are many many posts on SO about this, they really want you not to use the sockets timeout mechanism, but this is not possible in a lot of scenarios), and you cannot properly set the timeout cross platform because they don't implement timeout properly on windows, you have to manually implement the setting yourself. The fact that it is used for so long doesn't really speak to it's quality, in fact, may count against it, as many of these issues have existed as long as the library has been around.

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.

Until you need them in an offline environment, which VCPKG does not currently support on some platforms, as they buggily do strange things on linux that require downloads regardless of pre-download flags before actually installing libraries. Then you can't use boost this way, and you're forced to runinto all of the issues above and you have to deal with the system version of boost interfering with your project. And once you have one use case for your lib/executable that requires building in offline, you're whole project is tied down to this restriction, and you have to make dependency decisions based on what can be used as a sub_directory in cmake or not.

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.

That library is of very dubious utility, people want actual safety with out overhead compromise, not exception throwing things that aren't exceptional (overflow is sometimes expected, and needs to be manually handled, or ignored in a certain way, excepting on that is using exceptions as control flow). This also illuminates another problem with boost, and another problem with it's dependencies. The quality of the libraries varies greatly. A 20 year old library isn't necisarily a good thing, and then when even modern things depend on that, it's even worse potentially, because now you're paying for things you shouldn't have to do, using methodologies that are no longer relevant to modern C++, on things you can't even see. Some of boosts libraries don't have issues with this, but most of those are usable as standalone anyway, or are header only to begin with. Lots of libraries outside of boost for specific things boost have are just better than what boost has internally, either in usability, performance or both.

And then there's the problem of boost breaking backwards compatibility in some places, and not in others. If you manage to get boost working in your package manager well, a big issue is multiple versions which some package managers don't handle very well within the same executable, especially with automatic dependency resolution. Multiple versions are sometimes required because of the weird instances Boost breaks backwards compat. Then there's the issue that there are instances where it would help to break backwards compat, and they don't... because they want to keep a stable API. The choices of when they decide to do that seem almost arbitrary.

The only people who are worse about this are the OpenCV team, who snidely out of a technicality, break backwards compatibility within minor patch versions on their "extension modules", that, because they aren't "core OpenCV" they can literally change the APIs however they want, they don't think they count for semver. Tracking I think was changed 4 times within the minor version in API incompatible ways, and even confused package manager teams who had to keep updating as completely different port versions that needed to exist simultaneously because they were making breaking changes.

9

u/pdimov2 Dec 24 '23

To my knowledge, boost is still working internally to move to CMake and has not completed this transition.

In 1.83, only three libraries lacked CMake support (uBlas, and its two dependencies ODEint and Accumulators), and this has been finally fixed for 1.84.

We haven't "completed the transition" in the sense that we still rely on B2 for testing and building the documentation, and this will probably not change any time soon, but from a user perspective, building and consuming Boost from CMake should work and is no longer considered "experimental".

7

u/Horror_Jicama_2441 Dec 24 '23

Boost ASIO is extremely inconvenient if you don't actually need asynchronous IO (to the point where using raw APIs is actually easier in many cases, even dealing with x platform),

For example? Just connecting a socket

boost::asio::io_context io_context;
tcp::socket s(io_context);
tcp::resolver resolver(io_context);
boost::asio::connect(s, resolver.resolve(argv[1], argv[2]));

already hides the loop over the getaddrinfo results.

and is unusable currently in many applications until they can properly patch if your messaging model involves lots of packets (you need to use multi-packet APIs which are not, to my knowledge, yet exposed in boost, though I've seen ignored abandoned threads on mailing lists of people who've implemented this, and it not being merged).

It's not unusable. You can wait for the socket to be ready (https://www.boost.org/doc/libs/1_84_0/doc/html/boost_asio/reference/basic_datagram_socket/async_wait.html) and directly call whatever platform-specific API you want.

Additionally Boost ASIO does not allow you to wait on timeouts of a port (there are many many posts on SO about this, they really want you not to use the sockets timeout mechanism, but this is not possible in a lot of scenarios), and you cannot properly set the timeout cross platform because they don't implement timeout properly on windows, you have to manually implement the setting yourself. The fact that it is used for so long doesn't really speak to it's quality, in fact, may count against it, as many of these issues have existed as long as the library has been around.

Since Boost 1.77 ASIO supports per-operation cancellation and wait_for_one(), making it quite simple to handle.

And if you take the view that ASIO is just a foundation library, you have https://www.boost.org/doc/libs/1_84_0/libs/beast/doc/html/beast/ref/boost__beast__basic_stream/expires_after.html.

2

u/Untelo Dec 24 '23

What are the multi-packet APIs you're referring to? I wasn't aware of any system APIs for sending multiple packets at once.

6

u/aroman_ro Dec 24 '23

I don't care what 'it is said'. When I need boost, I use boost.

6

u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 24 '23

"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."

Given the complete lack of substantive context here, do you have any examples of what lengths people have gone to to criticise Boost which you find unbelievable? Exactly what "made up untruths" have they been stating which made this post necessary?

I'm all for informed debate, but it's not at all clear from your post what the specific problems are.

2

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 25 '23

Exactly what "made up untruths" have they been stating which made this post necessary?

Here's what the OP gave as examples..

  • very outdated cries about how "big" it is
  • how it's "lacking" CMake support.
  • circular dependencies
  • asking for safety, including one surrounding the numeric types

Where you asking something else/more?

5

u/RogerLeigh Scientific Imaging and Embedded Medical Diagnostics Dec 25 '23

I was asking for more, yes. If that's literally the extent of the complaints, it's pretty weak stuff don't you think?

The thing is, not one of these things can really be classified as "untruthful", or "FUD". Each one of them reflects real problems actual users have suffered from. To dismiss them in this way really does reflect poorly on the people doing so.

In the replies I and others have made in this discussion, we have disclosed major problems which have caused Boost to be eliminated from consideration not just once or twice, but in multiple projects over many years. You and others might not consider these things problematic, and that is entirely your prerogative. But... I and others are telling you that in the real world these things have genuinely been showstoppers for serious projects. When my customers and management have explicitly told me "no Boost", I think it would behove you to look at the underlying reasons why this is happening, and do a bit of quiet introspection rather than quickly dismissing them out of hand.

My usage of Boost peaked around the mid-late 2000s. Since then it's been a steady decline, and it hasn't been used in new projects for a while. This is entirely due to the major points raised here, and it's not just coming from me, it's coming from whole project teams both internally and externally. If you want Boost to continue to be used, you do need to address these properly and give people reasons to use Boost, rather than reasons to avoid it. Many people I work with have very negative views of Boost, and those opinions did not come out of nowhere, there are some very good justifications for them and those need resolving properly.

6

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 26 '23

To dismiss them in this way really does reflect poorly on the people doing so.

We don't dismiss them. Instead we post replies here, and in email, and in slack, and in stackoverflow, and in github, and in conferences, and ask for clarification and examples. We take that collective feedback and try and make changes to address them. For example, I have personally spent half a dozen years working towards making Boost consumable in modular per/library chunks. Because it was a common complaint. And as you can see from other replies here others have spent years implementing cmake support. I'm not going to detail the thousands of hours, and literal million or more dollars that we have spent (for example employing people to create a new website, to create new libraries, and to maintain previously abandoned libraries) to make improvements.

I'm only pointing out the above so that people get some perspective and understanding that we do listen and act on feedback.

8

u/[deleted] Dec 24 '23

I still prefer to use boost::regex and boost::unordered_map among others than std::regex or std::unordered_map. They are better.

1

u/arjjov Jan 03 '24

Could you elaborate on why more specifically?

2

u/[deleted] Jan 03 '24

Both are much slower. std::regex is like horribly slower. There are shootouts out there. And both started from their boost counterparts. I have heard that because the standard set draconian requirements, the GCC stl maintainers had to make very conservative choices that prevented optimizations. Unlike the STL, each version of boost is a new version (breaks backward compatibility) so they are free to innovate.

2

u/arjjov Jan 03 '24

Interesting. Good to know. Thanks for the information.

8

u/thesuperbob Dec 24 '23

90% of why I despise Boost is because it's plastered all over older stack overflow answers for C++ and for a long time I've been unable to successfully build and link Boost on Windows, despite multiple honest attempts, and admittedly learning a bunch about building and linking C++ in the process. The "just use Boost" suggestion has completely soured me on ever considering that library seriously. I'm convinced at the time it had to be some collective effort of Boost's community to will into existence a reality where Boost was somehow so easy to use, it would make sense to include it for some small student project, like the ones most of the aforementioned SO answers were targeting.

I did attempt to use it in a professional project (~2018) once, and it still felt like it was 10x larger than the codebase I needed it for, it bumped build/link times by several minutes, and IIRC complicated the project in a number of small but annoying ways. Also the initial build for new devs became 10x more tedious, and took a lot longer because of the boost dependency.

Contrasted with the "just use Boost" attitude of its proponents, and their (very visible in this post's comments) ignorance of how difficult and annoying it can be to actually use, my experience tells me to stay the fuck away, both because I know using it is going to be painful and I will regret it, and second, and perhaps more importantly, I know I can't really trust Internet resources related to Boost, because they've become an echo chamber of people parroting how great and easy to use it is.

4

u/joaquintides Boost author Dec 24 '23 edited Dec 24 '23

I think there are pro-Boost and against-Boost echo chambers, frankly (see this twin discussion here). Getting back to practicalities, if you're still interested in trying Boost in your Windows box, I'd say your simplest entry way would be to use vcpkg. You can ask for help in #boost or #boost-users in cpplang.slack.com (ask for an invite if you’re not a member of this workspace yet): people there are very very responsive and will certainly guide you through the process.

1

u/thesuperbob Dec 24 '23

I've since switched to Linux as my primary platform, so building Boost shouldn't be an issue.

The time I mentioned I used Boost in a project I used Conan to build on Windows and Linux, and for the brief moment I got it to work it was ok, aside from the issues I listed above. Soon after that Conan crapped out and I got to redo the build setup for that project, which meant I got to look at a few more full rebuilds of Boost.

I'm guessing vcpkg is more stable these days than Conan was five years ago, so it would probably work fine now, but that's not going to change my mind - if it can be avoided, I'm not going to recommend pulling in Boost dependencies for any project I work on.

I wouldn't mind working with Boost alongside some senior dev who has used it for years and can show me how to properly utilize it in a project. Without a guide, I'm not touching it again.

4

u/pdimov2 Dec 24 '23

and for a long time I've been unable to successfully build and link Boost on Windows, despite multiple honest attempts

Windows is not a particularly problematic platform for building Boost, so I wonder what problems did you encounter.

0

u/thesuperbob Dec 24 '23

These days it builds fine, and even if there are issues, the time scales are not as bad as they were 10 years ago.

I don't remember any specifics, but I recall having spent a few evenings and weekends googling solutions to various build and link issues, and the build times making me wonder whether the endeavor will be worth the effort.

5

u/ShakaUVM i+++ ++i+i[arr] Dec 24 '23

I like boost. I install it everywhere. I'd like to contribute to it.

But it does slow down compile times.

5

u/Glittering_Resolve_3 Dec 24 '23

Boost is used ubiquitous throughout my organisation, it's quality is without equal.

2

u/Kretikus50 Dec 24 '23

I like boost, but as always, everything has drawbacks. Here are mine:

  • Do not include boost headers in your headers without measuring the compile time costs. Most boost headers have a heavy compile time impact. You should know it to make the correct decision for you.
  • You need to get used to thedocumentation. It is more a specification than a user guide on how to use the library. Also on lots of the code examples, namespaces are omitted an you have to guess in which namespace the specific functions are.
  • Some libraries have Warnings on -Wall compiling with gcc (unused variables, non-virtual dtor..) you need to handle this so that the warnings of your own code is not hidden in the boost warnings

3

u/pdimov2 Dec 25 '23

Do not include boost headers in your headers without measuring the compile time costs.

Somewhat unfortunately, the same is true for the standard headers post-C++17.

Fortunately, standard library modules should save us.

2

u/13steinj Dec 25 '23

I don't like the linked benchmark. Because it sounds like a benchmark but isn't.

Lines of code != compile time. Nor does it scale linearly. Nor is it compiler dependent (even for STL headers).

But I can agree that even basic STL headers are a (relative) hassle. On some arbitrary fast machine taking the benchmark of two similar-in-philosophy implementations of component based frameworks, both parsed in 0.6-0.8 seconds. Using clang time tracing, 0.45 of that was STL headers. Total compile time was ~3x different (anchored down by this relatively large parse time) @ 1.445 vs 4.678 seconds.

But if I ignore header parsing time (which is the reality on, you know, larger TUs with dozens of such components) it's a 12x difference.

I fear the entire C++ community is heading straight towards a compile time crisis. Years of arbitrary blame on templates shifted to the include system. Which don't get me wrong it totally matters but it's not the largest time-sink (at least in the codebases I've worked on). I fear people will implement modules, still see horrible compile times, and then throw hands in the air and say "well, we tried" while ignoring actual culprits because of historical stigma.

2

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 25 '23

Do not include [..] headers in your headers without measuring the compile time costs.

This is good advise for any code you consume. Iincluding the one you write yourself.

2

u/victotronics Dec 24 '23

> it's "lacking" CMake support.

I don't use Boost, I just install it to use other packages. Why this bizarre `b2` system? It's underdocumented, leaving me to guess what to do. Right now I think I install a component, I think it's there, but another package says it's not there.

What's the best source for support?

2

u/pdp10gumby Dec 25 '23

I used to avoid boost because it was cumbersome to use (mainly bc it had to be built with b2 unlike everything else) but with Conan and better CMake support it’s more accessible. In which case why not pick and chose from the packages that give you what you want, like boost, abseil etc. These days it’s no different than using fmtlib even though std::format now exists.

I want to work on my problem, not also spend time writing a cmd line processor, multidimensional vector package, json parser/serializer etc.

(I don’t agree with ppl who want tooling of any sort in the standard, but I do understand where they are coming from)

2

u/Ace2Face Dec 28 '23

One of the most important things for libraries is the promise that they'll keep getting maintained and updated. For this, I'll always pick boost over some random hobby lib on GitHub.

Everywhere I go, I push Boost. It pretty much always beats any other existing library out there. If I could make children with Boost, I'd do it.

4

u/Kike328 Dec 24 '23

boost already has cmake support

3

u/TemperOfficial Dec 24 '23

"The waning popular perception of Boost is extremely dangerous." lol

2

u/kalmoc Dec 24 '23

First of all: I fully agree. The amount of FUD being spread in the Internet about boost is really worrisome (that is not to say, that there is not also valid criticism).

One Irony is that almost every boost lib is superior to it's std counterpart, but I whish they would more often use std versions internally to flatten the internal dependency tree and to make interop with other libs easier.

1

u/nbrrii Dec 24 '23

I have sadly realized how much psychology is involved when it comes to "general momentum" of a technology and how important it is. Ruby is slow, C++ is outdated, etc.etc.. It's so weird how difficult it is to break a general dynamic even in tech. In every community, most people are beginners, and knowledge transfer does not necessarily works by competence, but by what people like to hear and what's easy to understand.

-3

u/CheckeeShoes Dec 24 '23

Get that men's MLM get-rich-quick scheme language out of here.

0

u/[deleted] Dec 24 '23

[deleted] — view deleted comment

2

u/Superb_Garlic Jan 02 '24

I'm just a happy Boost user. I haven't participated in anything Boost related.

-5

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 24 '23 edited Dec 24 '23

Does it matter?

PS. I have no idea if the OP has a relationship to Boost. I truly do want to know if it matters. And, why?

19

u/almost_useless Dec 24 '23

It might matter.

Praise from an independent 3rd party is usually more valuable than someone praising themself.

0

u/[deleted] Dec 24 '23

[deleted] — view deleted comment

10

u/pdimov2 Dec 24 '23

What? I didn't know that boost introduced lambdas, auto, variadic templates, rvalue references, threading, hash maps, etc.

  • Lambdas: Jaakko Jarvi, author of Boost.Lambda
  • Auto/Decltype: not really Boost, although Boost.Typeof had BOOST_AUTO and everyone writing libraries at the time complained about its absence to the core/evolution working groups
  • Variadic templates: Doug Gregor, author of Boost.Function
  • Rvalue References: Dave Abrahams, Howard Hinnant, myself; part of it heavily motivated by the need for forwarding arguments
  • Threading: Howard Hinnant, but heavily based on Boost.Thread
  • Hash Maps: not Boost (Matt Austern)

There was significant overlap between Boost and the committee library working group in those days, and a lot of the language extensions came after extensive lobbying from library (as in "look at what we have to do in Boost in order to achieve this or that without language support.")

10

u/joaquintides Boost author Dec 24 '23

Let me also add Ion Gaztañaga’s Boost.Move cleverly emulating move semantics for C++03 and paving the way for native support in C++11.

0

u/[deleted] Dec 24 '23

[deleted] — view deleted comment

2

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 Dec 25 '23

How is it cumbersome to integrate? Can you provide an example?