What’s Boost?

With so many languages, libraries, tools, frameworks, and Internet fads to keep up with, sometimes you let a few slip through the cracks. This post is intended as an ultra quick primer (one of many) for anyone who let the Boost C++ libraries slip through the cracks. If you have used Boost before, this post is not for you.

Below is an edited version of an email conversation that I just had with one of my coworkers:

The libraries are aimed at a wide range of C++ users and application domains. They range from general-purpose libraries like the smart_ptr library, to OS abstractions like FileSystem, to libraries primarily aimed at other library developers and advanced C++ users, like the MPL.

The Wikipedia article does a pretty good job of explaining what boost is, but here’s a little more information. In non technical terms, Boost "contains a bunch of sneaky cool libraries that let you do some pretty sweet things in C++". The libraries can be a little daunting to look at when you first start, but those that I’ve messed with are pretty useful (and really cool under the hood). For those that have not messed around with boost but despise C++, part of the reason that I like C++ so much is because ideas and tools from boost as well as those found in the depths of the STL/TR1 (as well as other best practices) have made the language a lot easier and safer to use while also enabling you to do some really powerful things with the language.

Coworker:

Okay, so what’s the difference was between Boost and other Open Source Projects like Apache, which also has a lot of nice C++ libraries and has a license that allows you to both use the code in open and closed source projects?

Is there a different Metaphor here than simply: "It’s an open source foundation for C++"?

Me:

That’s essentially the metaphor, but I would change it to read:

"It’s THE open source foundation for C++"

Boost has implemented a lot of libraries that have gotten rolled back into the STL, so in a lot of ways, it’s like getting a new version of the C++ STL before it gets released except that you actually get a lot more libraries than will ever make it into the real STL. You also get a lot of things that really should have been in the STL, but were omitted for one reason or another (hash tables, for example). With the benefit of getting things that don’t have to go through all the red tape of the standards committee, you also have the downside of having libraries that are not universally a part of a standard C++ implementation of the STL which may or may not be a concern for you depending on your project’s requirements.

Anyway, boost is awesome if you’re a C++ dev (and you should already know about it if you are one). My only gripe has been that I have found their documentation to be a bit painful at times which can be a hassle since their libraries can be tricky to use the first time unless you have some good example code.