Introduction
Boost is a collection of peer-reviewed and high-quality libraries that aim to make application development more productive for all C++ developers.
Currently, there are over 180 libraries, and this number increases with regular new releases and updates.
Boost is publicly released three times per year (April, August, and December). Each new release has updates to existing libraries, and possibly new libraries that pass the rigorous acceptance process.
Feedback from the developer community is encouraged.
Advantages of using Boost
There are many advantages to using Boost in your C++ projects, the main one being using Boost avoids reinventing the wheel if there is a library that implements functions that you would otherwise have to write yourself. And of course the libraries are well engineered and tested, and not home-brewed. In addition to this:
-
Boost libraries are peer reviewed, well designed, and extensively tested.
-
Boost does not compete with the Standard Template Library (STL) for C++. Rather it complements the STL libraries with exciting new functionality. Many libraries that are now part of the STL started as Boost libraries.
-
Boost is open-source, and available for you to use in any of your projects. It is free, including for commercial projects. Refer to the Boost Software License.
-
Boost allows for cross-platform development, with single source code. Boost supports: Windows, Linux variants, Apple OS X, IOS, Android, and Xbox.
-
The Boost Libraries are designed to be as independent as possible so that users can pick and choose the libraries they need without being forced to include unnecessary code. Some libraries do have dependencies on a few others, and typically these other libraries are loaded automatically if just a subset of the full collection of libraries is being installed.
-
Particular strengths of the Boost libraries include smart pointers, unit tests, lambda functions, function binding, regex, a file system, to name a few.
-
Boost allows for all libraries to be installed and inspected. Alternatively a package manager can be used to install a specific collection of libraries.
-
Through template metaprogramming Boost libraries are a good platform for building other libraries.
-
Boost can be used in conjunction with graphics and games SDKs, such as OpenGL, Vulkan, and DirectX, and with game development engines such as the Unreal Engine.
-
It is easy to discuss and share your Boost experiences with other programmers.
Considerations when using Boost
The libraries implement a modern approach to C++ programming, generally prioritizing performance, correctness, cross-platform portability, efficiency and reusability. Boost offers building blocks, rather than a high-level app framework.
Boost is template-heavy, in order to provide portability and reusability, but this does make for dense syntax, which can take some getting used to.
Boost libraries are written by one, or a team, of independent developers. There will be minor differences in portability, standards, documentation, error reporting, and other aspects, between the libraries.
Library Categories
The current Boost libraries are categorized as follows (the count shows the number of current libraries in the category). Note that one library may appear in two or more categories.
Category |
Count |
Description |
Algorithms |
14 |
A range of libraries including several for 2D geometry, graphs, performance when iterating, sorting, string efficiency, and miscellaneous utility algorithms. |
Broken compiler workarounds |
2 |
Addresses compiler idiosyncrasies and help for non-conforming standard libraries. |
Concurrent Programming |
12 |
Libraries that address concurrency, threads, networking, sockets, context switching, memory, and other multi-threading functions. |
Containers |
22 |
Includes coverage of arrays, buffers, graphs, JSON, heaps, properties, stacks, and other storage constructs and issues. |
Correctness and testing |
7 |
Includes coverage of asserts, contracting, integer correctness, tracing, and unit testing. |
Data structures |
22 |
Supports of a wide range of data structures, including maps, containers, heaps, JSON, optional objects, pointers, polygons, properties, and stacks. |
Domain Specific |
5 |
Covers date and time utilities, cyclic redundancy code (CRC), unit analysis, and unique identifiers. |
Error handling and recovery |
4 |
Covers asserts, error reporting and handling, and an infrastructure for throwing exceptions. |
Function objects and higher-order programming |
17 |
Covers binding, function wrapping, function overloading, lambda functions, generic functions, and callback functions. |
Generic Programming |
15 |
A range of generalized libraries, including for passing parameters, function template overloads, handling operators and iterators, generic types and templates, parallel extensions. |
Image processing |
1 |
A single library for generic image processing. |
Input/Output |
11 |
Features include portable networking, conversions for correct byte ordering, formatting, streams, JSON, serialization, and URL parsing. |
Inter-language support |
1 |
A single library providing a framework for interfacing Python with C++. |
Iterators |
6 |
Covers iterations in images, graphs, arithmetic classes, and tokens. |
Language Features Emulation |
11 |
Covers language features such as reflection, exceptions, semantics, deterministic failure, parameters, scope, types, and typeof. |
Math and numerics |
24 |
Covers many math issues, such as statistics, types and conversions, geometry, histograms, trigonometry, common factors, Octonions, Quaternions, n-dimensional arrays, equations, operators, polygons, vectors, matrices, random numbers, ratios, rational numbers, safe integers, and linear algebra. |
Memory |
4 |
Memory functions including for alignment, allocators, traits, pool management, smart pointers, non-copyable classes. |
Parsing |
3 |
Libraries providing a parsing framework, covering grammars, primitives, directives, and other language features. |
Patterns and Idioms |
5 |
Covers design patters, empty member optimization, deterministic failure, callbacks non-copyable classes. |
Preprocessor Metaprogramming |
3 |
Covers macro parameters, repetition, recursion, macro data. |
Programming Interfaces |
5 |
Covers object wrappers for deferred calls or callbacks, deterministic failure, parameters, Python bindings, error reporting. |
State Machines |
2 |
Covers high-performance and arbitrarily complex finite state machines. |
String and text processing |
14 |
Covers type conversion, string formatting, streams, localization, regular expressions, parsing, string algorithms, tokens. |
System |
11 |
Time utilities, context switching, handling libraries, threads, a smart file system, processes, backtraces, errors. |
Template Metaprogramming |
15 |
Libraries to support the development of libraries, with features such as callable traits, reflection, function types, tuples, higher-order functions, parsing, sequences, metafunctions, static assertions, introspection, properties, expressions. |
Summary
The purpose of the Boost libraries is to evangelize and support C++ development. You can take advantage of thousands of lines of high performance code.