You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Boost是否会推出基于现代C++(如C++17)的精简版本?

Boost and Standard Library Overlap: Is a "Trimmed" Version in the Works?

Great question! Let's break this down clearly based on how the Boost project operates and its current plans:

  • No official "stripped-down" Boost version removing standard-covered components exists (or is planned right now)
    Boost's core philosophy prioritizes backward compatibility above all else. Tons of existing codebases—especially those stuck on older C++ standards (pre-C++17) that don't have access to std::optional, std::variant, etc.—rely on Boost's implementations. Removing these components overnight would break countless projects, which the Boost team has no interest in doing.

  • Many Boost components already support switching to standard library implementations
    For compilers that support C++17 or newer, most Boost components that have been standardized offer preprocessor macros to opt into using the standard library version instead of Boost's own. For example:

    • Define BOOST_USE_STD_OPTIONAL to make Boost.Optional wrap std::optional
    • Define BOOST_USE_STD_VARIANT to use std::variant under the hood of Boost.Variant
      This lets you keep using Boost's familiar API while leveraging the standard library's implementation, giving you the best of both worlds.
  • Some Boost components outpace their standard counterparts
    Even after parts of a Boost library get standardized, the Boost version often continues to evolve with extra features or broader platform support. Take Boost.Asio: while parts of it made it into the C++20 Networking TS, Boost.Asio still includes more advanced asynchronous patterns, support for additional protocols, and better compatibility with niche platforms. Many developers stick with Boost.Asio precisely because it offers more than the standard library's networking tools.

  • Modularization discussions exist, but no concrete "trimmed" plan
    The Boost community has floated ideas around making the library more modular, letting users pick and choose only the non-standardized components they need. However, there's no official roadmap for a full "remove all standard-covered content" release. The tradeoff—breaking existing compatibility vs. a slightly smaller library footprint—just doesn't make sense for most users right now.

内容的提问来源于stack exchange,提问作者einpoklum

火山引擎 最新活动