C++

Which Boost features overlap with C11

25 September 2026 · 8 min read

Which Boost features overlap with C11

The landscape of C++ development has been profoundly shaped by two major forces: the continuous evolution of the C++ Standard Library and the innovative contributions of the Boost C++ Libraries. For decades, Boost served as a crucial proving ground, introducing cutting-edge features that often paved the way for their inclusion in the official C++ standard. This relationship became particularly evident with the release of C++11, a monumental update that integrated many functionalities previously available only through Boost. Understanding which Boost features overlap with C++11 is essential for modern C++ programmers, helping them decide between relying on the standard library or augmenting their projects with Boost. This article delves into these overlaps, offering insights into how C++11 modernized the language and absorbed many of Boost’s pioneering utilities, fundamentally changing the approach to robust and efficient C++ development.

The Evolution of C++ and Boost’s Pivotal Role

Before C++11, the C++ Standard Library, while powerful, often lagged behind the needs of professional developers. This void was expertly filled by the Boost C++ Libraries, a collection of peer-reviewed, open-source libraries that pushed the boundaries of what was possible in C++. Boost wasn’t just a third-party toolkit; it was often viewed as a “staging ground” for potential C++ standard library features. Its high quality, portability, and adherence to C++ principles made it an indispensable resource for advanced projects.

The release of C++11 marked a turning point, ushering in an era of significant modernization. This standard introduced a plethora of new language features and library components, many of which directly addressed common programming challenges that Boost had already tackled. Bjarne Stroustrup, the creator of C++, often highlighted Boost’s role, stating, “Boost provides industrial-strength libraries that are used by millions of developers. Many of the most successful Boost libraries have been incorporated into the C++ standard library.” This integration streamlined development, reducing the need for external dependencies for fundamental tasks and bringing consistency to the language.

While Boost continued to innovate, C++11 provided developers with a robust set of tools directly in the standard, offering standardized solutions for tasks like memory management, type traits, and concurrency. This shift allowed developers to write more expressive, safer, and efficient code without relying on external libraries for core functionalities that became part of the language’s official specification.

Key Overlapping Features: From Boost to Standard C++11

Many of the most celebrated additions in C++11 had direct or indirect precedents in Boost. These overlaps are not coincidences but rather a testament to Boost’s influence and the C++ committee’s commitment to incorporating proven, high-quality solutions into the standard. Understanding these direct influences helps developers appreciate the journey of C++ modernization.

  • Smart Pointers: Boost’s boost::shared_ptr and boost::weak_ptr were arguably the most impactful contributions that found their way into C++11 as std::shared_ptr and std::weak_ptr. These utilities revolutionized memory management, virtually eliminating many common memory leaks and dangling pointer issues by automating resource deallocation through reference counting.
  • Lambda Functions and Function Objects: Before C++11 introduced native lambda expressions, Boost offered utilities like boost::bind and boost::function to create flexible function objects and callbacks. While boost::bind is largely superseded by C++11’s powerful lambda syntax, std::function became the standardized version of boost::function, providing a generic type-erased wrapper for callable entities.
  • Move Semantics: Although not a direct library component, the concept of move semantics and rvalue references, a cornerstone of C++11 for efficient resource transfer, was heavily influenced by Boost’s exploration of similar ideas in various contexts, particularly in optimizing container operations and unique resource ownership.
  • Type Traits: The extensive set of type traits in C++11’s <type_traits> header has its roots in Boost.TypeTraits. These compile-time utilities allow for introspection and manipulation of types, enabling more robust and generic metaprogramming techniques.
  • Thread and Concurrency Utilities: Boost.Thread provided a portable threading library long before C++11 introduced std::thread, std::mutex, std::condition_variable, and other concurrency primitives. While the C++11 standard library offerings are comprehensive, Boost.Thread served as a critical blueprint and proof-of-concept for safe and effective multithreading in C++.

These examples illustrate how Boost acted as a crucible, testing and refining features that were eventually deemed robust enough for the standard. This evolution meant that developers could often transition from Boost versions to standard library equivalents with minimal changes, benefiting from standardized behavior and broader compiler support.

Smart Pointers: boost::shared_ptr and std::shared_ptr

The introduction of smart pointers in C++11 was a game-changer for resource management. Specifically, std::shared_ptr directly mirrors the functionality of Boost’s long-standing boost::shared_ptr. Both provide shared ownership of an object through a pointer, managing its lifetime automatically via reference counting. When the last shared_ptr owning a particular object is destroyed, the object itself is automatically deleted.

For example, instead of manually calling delete and risking memory leaks or double deletions, developers could write:

std::shared_ptr<MyClass> ptr = std::make_shared<MyClass>();

This simple line ensures that MyClass will be correctly deallocated when no shared_ptr instances point to it. The primary difference for most users between the Boost and standard versions is simply the namespace; their behavior and usage patterns are remarkably similar, reflecting the direct adoption by the C++ standard committee. This specific overlap significantly simplifies modern C++ development by providing a robust and standardized approach to memory management.

Lambda Functions and boost::bind

Before C++11, creating small, inline function objects for algorithms or callbacks often involved writing custom structs or using utilities like boost::bind. boost::bind allowed developers to create function objects by binding arguments to existing functions, effectively currying them. For instance, binding an argument to a member function or a free function was a common pattern.

C++11 introduced native lambda functions, which provided a more concise and powerful syntax for defining anonymous function objects directly within the code where they are used. Lambdas can capture variables from their enclosing scope, making them extremely flexible for use with standard algorithms and event handlers. For example, a lambda can replace:

std::sort(vec.begin(), vec.end(), boost::bind(std::less<int>(), _1, 10)); // Old Boost style std::sort(vec.begin(), vec.end(),
<b>Question & Answer : </b><br></br><p>I put my C++ skills on the shelf several years ago and it seems now, when I need them again, the landscape has changed.</p> <p>We have got C++11 now, and my understanding is that it overlaps many Boost features.</p> <p>Is there some summary where those overlaps lie, which Boost libraries going to become legacy, recommendation of which C++11 features to use instead of boost ones and which better not? </p>
<br></br><p>Replaceable by C++11 language features or libraries</p> <ul> <li><a href="http://www.boost.org/doc/libs/release/doc/html/foreach.html" rel="noreferrer">Foreach</a> → <a href="http://en.cppreference.com/w/cpp/language/range-for" rel="noreferrer">range-based for</a></li> <li><a href="http://www.boost.org/doc/libs/release/libs/functional/forward" rel="noreferrer">Functional/Forward</a> → Perfect forwarding (with <a href="http://en.cppreference.com/w/cpp/language/reference" rel="noreferrer">rvalue references</a>, <a href="http://en.cppreference.com/w/cpp/language/parameter_pack" rel="noreferrer">variadic templates</a> and <a href="http://en.cppreference.com/w/cpp/utility/forward" rel="noreferrer">std::forward</a>)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/utility/in_place_factories.html" rel="noreferrer">In Place Factory, Typed In Place Factory</a> → Perfect forwarding (at least for the documented use cases)</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/lambda.html" rel="noreferrer">Lambda</a> → <a href="http://en.cppreference.com/w/cpp/language/lambda" rel="noreferrer">Lambda expression</a> (in non-polymorphic cases)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/local_function" rel="noreferrer">Local function</a> → Lambda expression</li> <li><a href="http://www.boost.org/doc/libs/release/libs/algorithm/minmax/" rel="noreferrer">Min-Max</a> → <a href="http://en.cppreference.com/w/cpp/algorithm/minmax" rel="noreferrer">std::minmax</a>, <a href="http://en.cppreference.com/w/cpp/algorithm/minmax_element" rel="noreferrer">std::minmax_element</a></li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/ratio.html" rel="noreferrer">Ratio</a> → <a href="http://en.cppreference.com/w/cpp/numeric/ratio/ratio" rel="noreferrer">std::ratio</a></li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/boost_staticassert.html" rel="noreferrer">Static Assert</a> → static_assert</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/thread.html" rel="noreferrer">Thread</a> → <thread>, etc (but check <a href="https://stackoverflow.com/questions/7241993/is-it-smart-to-replace-boostthread-and-boostmutex-with-c11-equivalents">this question</a>).</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/typeof.html" rel="noreferrer">Typeof</a> → auto, decltype</li> <li><a href="http://www.boost.org/doc/libs/release/libs/utility/value_init.htm" rel="noreferrer">Value initialized</a> → List-initialization (§8.5.4/3)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/math/doc/html/special.html" rel="noreferrer">Math/Special Functions</a> → <cmath>, see the list below <ul> <li>gamma function (tgamma), log gamma function (lgamma)</li> <li>error functions (erf, erfc)</li> <li>log1p, expm1</li> <li>cbrt, hypot</li> <li>acosh, asinh, atanh</li> </ul></li> </ul> <p>TR1 (they are marked in the <a href="http://www.boost.org/doc/libs/release/?view=filtered_std-tr1" rel="noreferrer">documentation</a> if those are TR1 libraries)</p> <ul> <li><a href="http://www.boost.org/doc/libs/release/doc/html/array.html" rel="noreferrer">Array</a> → std::array</li> <li><a href="http://www.boost.org/doc/libs/release/libs/bind/doc/html/bind.html" rel="noreferrer">Bind</a> → std::bind</li> <li><a href="http://www.boost.org/doc/libs/release/libs/core/doc/html/core/enable_if.html" rel="noreferrer">Enable If</a> → std::enable_if</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/function.html" rel="noreferrer">Function</a> → std::function</li> <li><a href="http://www.boost.org/doc/libs/release/libs/bind/doc/html/mem_fn.html" rel="noreferrer">Member Function</a> → std::mem_fn</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/boost_random.html" rel="noreferrer">Random</a> → <random></li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/ref.html" rel="noreferrer">Ref</a> → std::ref, <a href="http://en.cppreference.com/w/cpp/utility/functional/ref" rel="noreferrer">std::cref</a></li> <li><a href="http://www.boost.org/doc/libs/release/libs/regex" rel="noreferrer">Regex</a> → <regex></li> <li><a href="http://www.boost.org/doc/libs/release/libs/utility/utility.htm#result_of" rel="noreferrer">Result Of</a> → <a href="http://en.cppreference.com/w/cpp/types/result_of" rel="noreferrer">std::result_of</a></li> <li><a href="http://www.boost.org/doc/libs/release/libs/smart_ptr/" rel="noreferrer">Smart Ptr</a> → std::unique_ptr, std::shared_ptr, std::weak_ptr (but boost::intrusive_ptr still cannot be replaced)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/utility/swap.html" rel="noreferrer">Swap</a> (swapping arrays) → std::swap</li> <li><a href="http://www.boost.org/doc/libs/release/libs/tuple" rel="noreferrer">Tuple</a> → std::tuple</li> <li><a href="http://www.boost.org/doc/libs/release/libs/type_traits" rel="noreferrer">Type Traits</a> → <type_traits></li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/unordered.html" rel="noreferrer">Unordered</a> → <unordered_set>, <unordered_map></li> </ul> <p>Features back-ported from C++11:</p> <ul> <li><a href="http://www.boost.org/doc/libs/release/doc/html/atomic.html" rel="noreferrer">Atomic</a> ← std::atomic </li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/chrono.html" rel="noreferrer">Chrono</a> ← <chrono> (see below)</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/move.html" rel="noreferrer">Move</a> ← Rvalue references</li> </ul> <p>Replaceable by C++17 language features:</p> <ul> <li><a href="http://www.boost.org/doc/libs/release/libs/utility/doc/html/string_ref.html" rel="noreferrer">String_ref</a> → std::string_view</li> <li><a href="http://www.boost.org/doc/libs/release/libs/filesystem" rel="noreferrer">Filesystem</a> → <a href="http://en.cppreference.com/w/cpp/filesystem" rel="noreferrer"><filesystem></a> (Filesystem TS)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/optional" rel="noreferrer">Optional</a> → std::optional (<a href="https://isocpp.org/files/papers/p0220r1.html" rel="noreferrer">Library Fundamentals TS v1</a>)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/any" rel="noreferrer">Any</a> → std::any (Library Fundamentals TS v1)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/math/doc/html/special.html" rel="noreferrer">Math/Special Functions</a> → <cmath> (<a href="http://en.cppreference.com/w/cpp/numeric/special_math" rel="noreferrer">Special Math IS</a>), see the list below <ul> <li>beta function</li> <li>(normal / associated / spherical) Legendre polynomials</li> <li>(normal / associated) Legendre polynomials </li> <li>Hermite polynomials</li> <li>Bessel (J / Y / I / K) functions (Y is called Neumann function in C++)</li> <li>spherical Bessel (j / y) functions</li> <li>(incomplete / complete) elliptic integrals of (first / second / third kind)</li> <li>Riemann zeta function</li> <li>exponential integral Ei</li> </ul></li> <li><a href="http://www.boost.org/doc/libs/release/libs/variant/" rel="noreferrer">Variant</a> → std::variant (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0088r2.html" rel="noreferrer">P0088R2</a>)</li> </ul> <p>The standard team is still working on it:</p> <ul> <li><a href="http://www.boost.org/doc/libs/release/libs/math/doc/html/gcd_lcm.html" rel="noreferrer">Math Common Factor</a> → std::experimetal::gcd, lcm (Library Fundamentals TS v2)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/concept_check" rel="noreferrer">Concept check</a> → Concepts TS</li> <li><a href="http://www.boost.org/doc/libs/release/libs/range/" rel="noreferrer">Range</a> → Range TS</li> <li><a href="http://www.boost.org/doc/libs/release/doc/html/boost_asio.html" rel="noreferrer">Asio</a> → Networking TS (sockets and timers only)</li> <li><a href="http://www.boost.org/doc/libs/release/libs/multiprecision" rel="noreferrer">Multiprecision</a> → Numerics TS</li> <li><a href="http://www.boost.org/doc/libs/release/libs/coroutine" rel="noreferrer">Coroutine</a>/<a href="http://www.boost.org/doc/libs/release/libs/coroutine2" rel="noreferrer">Coroutine2</a> → Coroutines TS</li> </ul> <p>A large part of <a href="http://www.boost.org/doc/libs/release/libs/mpl/doc/index.html" rel="noreferrer">MPL</a> can be trimmed down or removed using variadic templates. Some common use cases of <a href="http://www.boost.org/doc/libs/release/doc/html/boost_lexical_cast.html" rel="noreferrer">Lexical cast</a> can be replaced by std::to_string and std::sto<i>X</i>.</p> <p>Some Boost libraries are related to C++11 but also have some more extensions, e.g. <a href="http://www.boost.org/doc/libs/release/doc/html/hash.html" rel="noreferrer">Boost.Functional/Hash</a> contains <a href="http://www.boost.org/doc/libs/release/doc/html/hash/combine.html" rel="noreferrer">hash_combine</a> and related functions not found in C++11, <a href="http://www.boost.org/doc/libs/release/doc/html/chrono.html" rel="noreferrer">Boost.Chrono</a> has I/O and rounding and many other clocks, etc. so you may still want to take a look at the boost ones before really dismissing them.</p>