Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of using the C++ Boost libraries? [closed]

Tags:

c++

boost

People also ask

What is the boost library used for?

Boost is a set of libraries for the C++ programming language that provides support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing. It contains 164 individual libraries (as of version 1.76).

Should I use boost libraries?

The important reasons to consider using BOOST include: most libraries are pretty well tested and designed: they generally get a reasonably sound review by some excellent programmers, compared to by people with home-brew solutions in the same problem space, and widely used enough to gather extensive real-world feedback.

How many Boost libraries are there?

Boost libraries consist of a set of over 80 libraries for the C++ programming language. The libraries are available for free and can be used for both free and proprietary software projects.

Is Boost C++ library free?

Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work well with the C++ Standard Library. Boost libraries are intended to be widely useful, and usable across a broad spectrum of applications.


Boost is used so extensively because:

  • It is open-source and peer-reviewed.
  • It provides a wide range of platform agnostic functionality that STL missed.
  • It is a complement to STL rather than a replacement.
  • Many of Boost developers are on the C++ standard committee. In fact, many parts of Boost is considered to be included in the next C++ standard library.
  • It is documented nicely.
  • Its license allows inclusion in open-source and closed-source projects.
  • Its features are not usually dependent on each other so you can link only the parts you require. [Luc Hermitte's comment]

From the home page:

"...one of the most highly regarded and expertly designed C++ library projects in the world." — Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

"Item 55: Familiarize yourself with Boost." — Scott Meyers, Effective C++, 3rd Ed.

"The obvious solution for most programmers is to use a library that provides an elegant and efficient platform independent to needed services. Examples are BOOST..." — Bjarne Stroustrup, Abstraction, libraries, and efficiency in C++

So, it's a range of widely used and accepted libraries, but why would you need it?

If you need:

  • regex
  • function binding
  • lambda functions
  • unit tests
  • smart pointers
  • noncopyable, optional
  • serialization
  • generic dates
  • portable filesystem
  • circular buffers
  • config utils
  • generic image library
  • TR1
  • threads
  • uBLAS

and more when you code in C++, have a look at Boost.


Because they add many missing things to the standard library, so much so some of them are getting included in the standard.

Boost people are not lying:

Why should an organization use Boost?

In a word, Productivity. Use of high-quality libraries like Boost speeds initial development, results in fewer bugs, reduces reinvention-of-the-wheel, and cuts long-term maintenance costs. And since Boost libraries tend to become de facto or de jure standards, many programmers are already familiar with them.

Ten of the Boost libraries are included in the C++ Standard Library's TR1, and so are slated for later full standardization. More Boost libraries are in the pipeline for TR2. Using Boost libraries gives an organization a head-start in adopting new technologies.

Many organization already use programs implemented with Boost, like Adobe Acrobat Reader 7.0.


A few Boost classes are very useful (shared_ptr), but I think they went a bit nuts with traits and concepts in Boost. Compile times and huge binary sizes are completely insane with Boost, as is the case with any template-heavy code. There has to be a balance. I'm not sure if Boost has found it.


BOOST's a collection of libraries filling needs common to many C++ projects. Generally, they do prioritise correctness, reusability, portability, run-time performance, and space-efficiency over readability of BOOST implementation code, or sometimes compile times. They tend not to cover complete high-level functional requirements (e.g. application frameworks), and instead (thankfully) offer building blocks that can be more freely combined without dictating or dominating the application design.

The important reasons to consider using BOOST include:

  • most libraries are pretty well tested and designed: they generally get a reasonably sound review by some excellent programmers, compared to by people with home-brew solutions in the same problem space, and widely used enough to gather extensive real-world feedback
  • it's already written and your solution probably isn't
  • it's pretty portable (but that varies per library)
  • more people in the C++ community will have a head-start in helping you with your code
  • BOOST is often a proving ground for introduction to the C++ Standard, so you'll have less work to do in rewriting your code to be compatible with future Standards sans BOOST
  • due to the community demand, compiler vendors are more likely to test and react to issues of correctness with BOOST usage
  • familiarity with boost libraries will help you do similar work on other projects, possibly in other companies, where whatever code you might write now might not be available for reuse

The libraries are described in a line or two here: http://www.boost.org/doc/libs/.