Boost

Boost

Boost C++ Libraries (usually just called Boost) is a large, open-source collection of high-quality C++ libraries that extend the functionality of standard C++. It’s widely used in both industry and research, and many Boost libraries have eventually become part of the official C++ standard.

Most of the Boost libraries are licensed under the Boost Software License, designed to allow Boost to be used with both free and proprietary software projects. Many of Boost's founders are on the C++ standards committee, and several Boost libraries have been accepted for incorporation into both Technical Report 1 and the C++11 standard.

Why do we use Boost?

Boost is used to:

• Fill gaps in the C++ standard library
• Provide advanced features before they become standard
• Speed up development with ready-made, well-tested components

For example:

• Smart pointers in Boost existed before C++11 introduced them
• Filesystem support existed in Boost before becoming standard

When should you use Boost?

Use Boost when:

• You need functionality not available in standard C++
• You want robust, well-tested libraries
• You are working on:
• High-performance systems
• Networking applications
• Scientific computing
• Game engines

Avoid it if:

• You want minimal dependencies
• Your project must stay lightweight or simple

Key Features

• Header-only libraries (many don’t require compilation)
• Highly portable across platforms
• Peer-reviewed and production-quality
• Covers a wide range of programming needs
• Often influences or becomes part of the C++ standard

Key Components (Popular Boost Libraries)

1. Smart Pointers

• boost::shared_ptr
• boost::unique_ptr (pre-C++11)

2. Boost.Asio

• Networking and asynchronous I/O
• Used for building servers and real-time systems

3. Boost.Thread

Multithreading support (similar to POSIX threads but C++-friendly)

4. Boost.Filesystem

Portable file and directory operations

5. Boost.Regex

Regular expression handling

6. Boost.Spirit

Parsing library (build parsers directly in C++)

Advantages

• High-quality, well-tested code
• Saves development time
• Cross-platform compatibility
• Many libraries later become part of standard C++
• Strong community support

Disadvantages

• Can be large and complex
• Compilation can be slow (especially non-header-only parts)
• Some libraries are hard to learn
• Overkill for small/simple projects

More details about Boost

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. The Boost license encourages both commercial and non-commercial use.

The libraries are aimed at a wide range of C++ users and application domains. They range from general-purpose libraries like the smart pointer library, to operating system abstractions like Boost FileSystem, to libraries primarily aimed at other library developers and advanced C++ users, like the template metaprogramming (MPL) and domain-specific language (DSL) creation (Proto).

In order to ensure efficiency and flexibility, Boost makes extensive use of templates. Boost has been a source of extensive work and research into generic programming and metaprogramming in C++.

Most Boost libraries are header based, consisting of inline functions and templates, and as such do not need to be built in advance of their use. Some Boost libraries coexist as independent libraries.

Contents related to 'Boost'

C++11, C++0x
C++11, C++0x
QT
QT
Comparison of APR, POSIX, BOOST, QT
Comparison of APR, POSIX, BOOST, QT