February 23, 2019

Boost Your C++ Programming - page 3


  • October 17, 2005
  • By Ibrahim Haddad

LP: There are many Boost libraries out there. Which ones are your favorites and why?

I'll select only three libraries, or else I fear that my answer will be longer than you're willing to publish...

  • Boost.Smart_ptr. The motivation is that these smart pointers do their job so well. You'll find scoped pointers that avoid the pitfalls of auto_ptr, reference-counted smart pointers for shared ownership of resources, and smart pointers that observe other smart pointers--alleviating the problem of dangling pointers.
  • Boost.Lambda. This library allows you to create function objects on the fly, using a very neat syntax. Lambda expressions are ubiquitous in functional programming languages, but this library demonstrates that it is not only technically possible to support lambda expressions in C++; it's also very useful. I use Boost.Lamda all the time for defining function objects at the call site of STL algorithms.
  • Boost.Regex. Regular expressions are superb for many text-crunching problems. With this library comes support for a wide range of different flavors of regular expressions, and a set of algorithms that are very easy to use. In short, this is a fantastic C++ library for regular expressions.

LP: A few weeks ago I interviewed Scott Meyers and he argued that C++ will play an increasingly important role in embedded systems programming. What's your take on that? And are they are Boost libraries that target the embedded programming space?

I've read the article, and I think that Scott makes some very valid points. The most important argument is that the complexity of the programs--which are now on par with any other program--must be handled. C++ does have a reputation of handling large-scale systems very well, so why shouldn't that apply to embedded systems? Although there are no Boost libraries that specifically target the embedded programming space, many libraries provide hooks for systems that do not support exception handling.

LP: What is the license under which the Boost libraries are released? How does it compare to GPL?

Boost libraries are released under the Boost Software License--there are some libraries that haven't yet been converted to that license, but all libraries comply with the requirements set forth by the Boost--which means that the libraries can be freely copied, used, and modified. The Boost Software License is even more relaxed than the GPL: There's no requirement to release source code that uses Boost libraries, you don't have to reproduce copyright messages for object code redistribution, and the license does not effect the license of code that uses Boost libraries.

Most Popular LinuxPlanet Stories