Explore the Content
There are a number of ways you can approach exploring Boost. Clearly, examining the documentation for any of the Boost libraries is a great way to start. However, with 180 or so libraries to choose from, you might want to consider a range of options to get going. This section covers a number of approaches you have to focus your exploration of the libraries, and get deeper into Boost content.
If knowing what others have done before you helps, refer to High-Profile users of Boost.
If you are already using, or considering, the Standard Template Library then refer to Boost vs the Standard Library to get some idea of which to use when similar ones are available in both sets of libraries.
If any of the libraries does pique your interest, consider examining and running working Examples.
There are mailing lists you might want to join too, to ask questions and join in the discussion, such as the Boost Users mailing list, or project-specific lists accessible from the Boost Mailing Lists site.
To delve into content for a specific scenario, refer to the Common Scenarios topics, such as:
And, to the Advanced Scenarios topics such as:
High-Profile users of Boost
Some well known libraries and applications have used the building blocks that Boost provides. These include:
-
Folly, the Facebook Open Source Library, is an open-source library developed by Facebook that is intended to augment the Standard Library and Boost by providing additional features and optimizations, often with a focus on high-performance systems. It is a collection of relatively small and standalone libraries, and its features can be used on an as-needed basis.
Some of these features include string formatting libraries, hash maps, dynamic types, and concurrency utilities. Folly makes extensive use of:
-
Boost.Context for creating and manipulating execution contexts, which are used in Folly’s implementation of coroutines
-
Boost.Intrusive which provides containers that allow for the insertion and removal of elements in constant time
-
Boost.Optional which provides a way to represent optional, or nullable, objects of a given type
Additionally, many parts of Folly are designed to interact seamlessly with Boost and the Standard Library, making it easy to integrate Folly into existing codebases that use these libraries. Folly serves as an example of how Boost libraries can be used in the development of large-scale, high-performance systems.
-
-
The Bitcoin Core client, which is the reference implementation of the Bitcoin protocol, makes extensive use of the Boost libraries. For example, it uses Boost.Asio for network programming, Boost.Thread for multithreading, and Boost.Test for unit tests.
-
MongoDB, a popular open-source document database, leverages libraries such as Boost.Filesystem for filesystem interactions, Boost.Thread for threading, and Boost.SmartPtr for smart pointers.
-
The Low Level Virtual Machine (LLVM) project, which is a collection of modular and reusable compiler and toolchain technologies, utilizes Boost in parts of its code base. For instance, it uses Boost.Mpl for its metaprogramming functionality.
Boost.Mpl has now been superseded by Boost.Mp11. |
-
Microsoft has integrated Boost.Test into Visual Studio, in particular to enable unit testing.
-
Adobe also uses Boost in several of their software products. For instance, Adobe Source Libraries (ASL) includes and builds upon Boost.SmartPtr, Boost.Mpl, Boost.Lambda.
-
The Robot Operating System (ROS), a flexible framework for robotics software development, uses Boost in several areas, for instance, Boost.Python to provide Python bindings, and Boost.Signals2 for inter-process communication.
-
React Native is a popular JavaScript framework for building mobile application. Boost libraries are used extensively within JavaScriptCore (used to execute JavaScript within the app), and are a key part of the infrastructure that allows React Native to bridge between JavaScript and native code. The libraries used include Boost.Optional, Boost.Intrusive, and Boost.MultiIndex.
-
MySQL one of the most popular open-source relational database management systems, uses Boost libraries in its build process. It mainly uses the Boost header files, particularly those required for geometry processing operations, such as Boost.Geometry.
Boost vs the Standard Library
There are several Boost libraries that have a Standard Template Library (STL) equivalent but offer more features, better performance, or additional functionality that can make them more compelling in certain situations. When comparing libraries which have similar features, also consider compilation time, binary size, code readability, and the portability of your code.
-
Boost.Any is similar to
std::any
, introduced in C++17. However, if you’re working with a codebase that needs to be compatible with pre-C++17 standards, then Boost.Any can be a lifesaver. -
Similar to the situation with Boost.Any, Boost.Optional provides functionality similar to
std::optional
, introduced in C++17, but works with earlier standards. -
While C++11 introduced smart pointers into the standard library (with
std::unique_ptr
andstd::shared_ptr
), Boost.SmartPtr offers some additional features. These features include the use ofintrusive_ptr
which allows for the customization of the reference-counting mechanism. -
Boost.Container offers some advanced containers like
flat_map
,small_vector
,static_vector
, andstable_vector
that are not available in STLstd::containers
. -
Boost.Random has more extensive features than
std::random
. -
Boost.Algorithm provides some algorithms that are not available in STL
std::algorithms
, such asboost::algorithm::all_of_equal
.
Examples
Many Boost libraries, but not all, have an example
folder that contains runnable source code projects for the library. To locate the examples, first navigate to the Super-project containing all the libraries, then select the library that interests you, then its' example
folder, if one exists.
For example: