Very often here on SO I see notes about boost such as
If you are fine with using Boost...
or
If you can use Boost...
And I wonder, what's that all about? What should I be weary of? When can't I use boost? What are the reasons not to use boost? In my opinion boost is a great extension to STL; sometimes very heavyweight and clumsy, but great nevertheless.
I am not really asking for opinions about boost as such. I am rather looking for some concrete examples when should I think twice before using boost.
The original founders of Boost that are still active in the community includes David Abrahams. An author of several books on C++, Nicolai Josuttis, contributed to the Boost array library in 2001. There are mailing lists devoted to Boost library use and library development, active as of 2020.
Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking. The only Boost libraries that must be built separately are: Boost.
When I can't use boost? In my opinion boost is great extension to STL, sometimes very heavyweight and clumsy, but great nevertheless.
Boost is not a library but a collection of largely independent libraries of individual quality. With this in mind, and also taking into account that I'm personally a big fan of most of Boost, here are some reasons I can think of for not using certain Boost libraries:
Because it's not an extension to the C++ Standard Library (nor to the STL, naturally).
It is a third-party distribution, that you must download and install, locally and (for some Boost libraries, if you dynamically link) on the target system. You must manage and document the dependency.
I shan't enumerate all the scenarios in which this is not feasible, but it should be self-evident that you cannot always use non-standard code. Not everybody is working on a platform on which you can simply write yum install boost-devel
, write your code and move on. The world of computers goes far beyond commodity desktop PCs.
That being said, most arguments for avoiding Boost are incredibly weak, due to its extreme portability, and the fact that the majority of Boost libraries are header-only (which reduces the packaging overhead significantly).
Seems like a lot of fuzz for nothing
I don't think writing the phrase "if you can use Boost" can be honestly described as "a lot of [fuss]".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With