The Boost C++ Libraries


There are more than a hundred Boost libraries. This book discusses the following libraries in detail:

Table 1. Covered libraries
Boost library Standard Short description
Boost.Accumulators Boost.Accumulators provides accumulators to which numbers can be added to get, for example, the mean or the standard deviation.
Boost.Algorithm Boost.Algorithm provides various algorithms that complement the algorithms from the standard library.
Boost.Any Boost.Any provides a type called boost::any, which can store objects of arbitrary types.
Boost.Array TR1, C++11 Boost.Array makes it possible to treat C++ arrays like containers from the standard library.
Boost.Asio Boost.Asio allows you to develop applications, such as network applications, that process data asynchronously.
Boost.Assign Boost.Assign provides helper functions to add multiple values to a container without having to call member functions like push_back() repeatedly.
Boost.Atomic C++11 Boost.Atomic defines the class boost::atomic to perform atomic operations on integral values. The library is used in multithreaded applications that need to share integral values between threads.
Boost.Bimap Boost.Bimap provides a class called boost::bimap, which is similar to std::map. The crucial difference is that boost::bimap allows you to search for both key and value.
Boost.Bind TR1, C++11 Boost.Bind is an adapter for passing functions as template parameters, even if the function signature is incompatible with the expected template parameter.
Boost.Chrono C++11 Boost.Chrono defines numerous clocks to get values such as the current time or the CPU time.
Boost.CircularBuffer Boost.CircularBuffer offers a circular container with a constant memory size.
Boost.CompressedPair Boost.CompressedPair provides the data structure boost::compressed_pair, which is similar to std::pair but needs less memory when template parameters are empty classes.
Boost.Container Boost.Container defines all of the containers from the standard library, plus additional containers like boost::container::slist.
Boost.Conversion Boost.Conversion provides two cast operators to perform downcasts and cross casts.
Boost.Coroutine Boost.Coroutine makes it possible to use coroutines in C++. Coroutines are often used in other programming languages using the keyword yield.
Boost.DateTime Boost.DateTime can be used to process, read, and write date and time values.
Boost.DynamicBitset Boost.DynamicBitset provides a structure similar to std::bitset, except that it is configured at run time.
Boost.EnableIf C++11 Boost.EnableIf makes it possible to overload functions based on type properties.
Boost.Exception Boost.Exception allows you to add additional data to thrown exceptions so you can provide more data to catch handlers.
Boost.Filesystem Boost.Filesystem provides a class to process paths and several functions to access files and directories.
Boost.Flyweight Boost.Flyweight makes it easy to use the design pattern of the same name.
Boost.Foreach Boost.Foreach provides a macro that is similar to the range-based for loop introduced with C++11.
Boost.Format Boost.Format replaces the function std::printf() with a type-safe and extensible class, boost::format.
Boost.Function TR1, C++11 Boost.Function simplifies the definition of function pointers.
Boost.Fusion Boost.Fusion allows you to create heterogeneous containers – containers that can store elements of different types.
Boost.Graph Boost.Graph provides algorithms for operations such as finding the shortest path between two points in a graph.
Boost.Heap Boost.Heap provides many variants of the class std::priority_queue from the standard library.
Boost.Integer C++11 Boost.Integer defines specialized types for integers that have been available to C developers since the standard C99 was released in 1999.
Boost.Interprocess Boost.Interprocess uses shared memory to help applications communicate quickly and efficiently.
Boost.Intrusive Boost.Intrusive defines containers that provide higher performance than containers from the standard library, but which also have special requirements for the objects they contain.
Boost.IOStreams Boost.IOStreams provides streams and filters. Filters can be connected with a stream to, for example, write compressed data.
Boost.Lambda Boost.Lambda allows you to define anonymous functions without C++11.
Boost.LexicalCast Boost.LexicalCast provides a cast operator to convert numbers to a string and vice versa.
Boost.Lockfree Boost.Lockfree defines thread-safe containers that multiple threads may access concurrently.
Boost.Log Boost.Log is the logging library in Boost.
Boost.MetaStateMachine Boost.MetaStateMachine makes it possible to develop state machines as they are defined in the UML.
Boost.MinMax C++11 Boost.MinMax provides an algorithm that can find the smallest and largest values in a container without calling std::min() and std::max().
Boost.MPI Boost.MPI provides a C++ interface for the MPI standard.
Boost.MultiArray Boost.MultiArray simplifies working with multidimensional arrays.
Boost.MultiIndex Boost.MultiIndex allows you to define new containers that can support multiple interfaces, such as the ones from std::vector and std::map.
Boost.NumericConversion Boost.NumericConversion provides a cast operator to safely convert between values of different numeric types without generating an overflow condition.
Boost.Operators Boost.Operators allows many operators to be automatically overloaded with the help of already defined operators.
Boost.Optional Boost.Optional provides a class to denote optional return values. Functions that can’t always return a result don’t need to use special values like -1 or a null pointer anymore.
Boost.Parameter Boost.Parameter lets you pass parameters to functions as name/value pairs like you can with programming languages like Python.
Boost.Phoenix Boost.Phoenix makes it possible to create lambda functions without C++11. Unlike the C++11 lambda functions, the lambda functions from this library can be generic.
Boost.PointerContainer Boost.PointerContainer provides containers that are optimized for managing dynamically allocated objects.
Boost.Pool Boost.Pool is a library to manage memory. For example, Boost.Pool defines an allocator optimized for situations where you need to create and destroy many objects, all of the same size.
Boost.ProgramOptions Boost.ProgramOptions allows an application to define and evaluate command-line options.
Boost.PropertyTree Boost.PropertyTree provides a container that stores key/value pairs in a tree-like structure. This makes it easier to manage the kind of configuration data used by many applications.
Boost.Random TR1, C++11 Boost.Random provides random number generators.
Boost.Range Boost.Range introduces a concept called range that replaces the iterators usually received from containers with begin() and end(). Ranges makes it so you don’t have to pass a pair of iterators to algorithms.
Boost.Ref TR1, C++11 Boost.Ref provides adapters that allow you to pass references to objects that can’t be copied to functions that pass parameters by copy.
Boost.Regex TR1, C++11 Boost.Regex provides functions to search strings with regular expressions.
Boost.ScopeExit Boost.ScopeExit provides macros to define code blocks that are executed when the current scope ends. That way, resources can be released at the end of the current scope without having to use smart pointers or other classes.
Boost.Serialization Boost.Serialization allows you to serialize objects and store them in files to be reloaded later.
Boost.Signals2 Boost.Signals2 is a framework for event handling based on the signal/slot concept, which associates functions with signals and automatically calls the appropriate function(s) when a signal is triggered.
Boost.SmartPointers TR1, C++11 (partly) Boost.SmartPointers provides a set of smart pointers that simplify managing dynamically allocated objects.
Boost.Spirit Boost.Spirit allows you to generate parsers using a syntax similar to EBNF (Extended Backus-Naur-Form).
Boost.StringAlgorithms Boost.StringAlgorithms provides many stand-alone functions to facilitate string handling.
Boost.Swap Boost.Swap defines boost::swap(), which has the same function as std::swap(), but is optimized for many Boost libraries.
Boost.System C++11 Boost.System offers a framework to process system- and application-specific error codes.
Boost.Thread C++11 Boost.Thread allows you to develop multithreaded applications.
Boost.Timer Boost.Timer defines clocks that let you measure code performance.
Boost.Tokenizer Boost.Tokenizer allows you to iterate over tokens in a string.
Boost.Tribool Boost.Tribool provides a type that, unlike bool, distinguishes three, rather than two, states.
Boost.Tuple TR1, C++11 Boost.Tuple provides a generalized version of std::pair that can store an arbitrary number of values, not just two.
Boost.TypeTraits TR1, C++11 Boost.TypeTraits provides functions to check properties of types.
Boost.Unordered TR1, C++11 Boost.Unordered provides two hash containers: boost::unordered_set and boost::unordered_map.
Boost.Utility Boost.Utility is a collection of various tools that are too small to have their own libraries and don’t fit in another library.
Boost.Uuid Boost.Uuid defines the class boost::uuids::uuid and generators to create UUIDs.
Boost.Variant Boost.Variant permits the definition of types that, like union, group multiple types.
Boost.Xpressive Boost.Xpressive makes it possible to search strings with regular expressions. Regular expressions are encoded as C++ code rather than as strings.

Presumably, the next version of the standard will be C++14. There are many project groups working on various topics for C++14. These activities are known as Technical Specifications (TS). For example, the File System TS works on an extension of the standard based on Boost.Filesystem to access files and directories. You can find more information on C++14 and the standardization of C++ at