C++11 and why I'm done with Boost

This entry is is not about ragging on Boost. I have used Boost for years now to compliment my C++ projects. And I would have been very lost without shared pointers, bound functions, and cross platform threading. But Boost's founders have been highly successful in impressing Boost APIs into the C++ standard. And if someone can drop using Boost because of the features available in C++11, then I would conclude that Boost has successfully done its job.

C++11 is prevalent in 2014

Nowadays, the C++11 standard is fairly easy to find on your typical OS platform. Its in every GCC for the last few years, OSX XCode with clang, and your recent Visual Studios. Although, Visual studio has taken its time getting everything in there. 2010 actually had some of the C++11 data types, without any of the new language features. 2012 is definitly acceptable for my use, and it looks like 2013 is substantially more complete.

Less demanding on new projects

Starting a new C++ project? Can C++11 replace your typical Boost library usage? Hopefully you dont have any really old compilers/systems to support... Then do it!

Project dependencies have a measurable cost; especially a dependency as large as Boost.

  • Installing development files (sometimes its easy (APT), sometimes its a pain).
  • The build system must locate the development files on a variety of platforms.
  • Distributing dependency libraries (and in some cases include files as well).
  • Dealing with different versions of the dependency, API changes, and bugs...

Unfortunately, Ubuntu has shipped with versions of Boost development packages with bugs. Critical bugs in the threading library, and lesser bugs that cause other compilation issues. Although Boost may have found and fixed the bug, and created a patch release, the OS (Ubuntu) never updated its package to reflect the bug fix. Broken forever, on an LTS release (which is only once per 2 years). GNU Radio has blacklisted versions of Boost because of this problem.

I hope that if the standard library implementation had a similar bug, that the fix would be taken seriously and APT repositories updated ASAP. At least a STL bug has a chance of being taken more seriously than the equivalent bug in a Boost development package.

  • Compiling against the C++11 headers is faster than Boost...

Boost has the legacy of trying to support the oldest and strangest compilers, and it shows. Look in a Boost header: ifdefs everywhere, several implementations of the same thing. The preprocesing overhead alone causes a measurable increase in compile time. Include a few Boost headers and build a cpp file with gcc using -E to show the preprocessor output. Its scary. Boost has dropped support for some older compilers. I hope that has cleaned up some of the implementation.

Boost still has more to offer

Like I said, this isnt about ragging on Boost. There is so much more in this project than C++11 has to offer. There is probably more in Boost than the C++ standard will ever hold. And since C++14 is only minor fixes and improvements over C++11, we probably wont see another major standard change for a long time. So enjoy the endless list of Boost libraries. I may just be going back to Boost when one of those many libraries comes calling.

Last edited: Sun, Sep 7 2014 - 07:57PM