mcpp index

compat.boost-config

#include

Boost.Config 1.92.0 — platform/compiler/stdlib detection macros; root of the modular-boost header family

#include <boost/version.hpp>
mcpp add compat.boost-config@1.92.0

用法

来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。

// Behavioral test: the compat.boost-config headers are present and identify
// themselves as exactly the pinned 1.92.0 train. If the descriptor ever
// drifts to another release without this member following, this fails loudly.
#include <boost/version.hpp>
#include <boost/config.hpp>
#include <string_view>

int main() {
    // BOOST_VERSION encodes major*100000 + minor*100 + patch -> 1.92.0.
    bool ok = BOOST_VERSION == 109200;
    ok = ok && std::string_view(BOOST_LIB_VERSION) == "1_92";

    // Platform detection must have positively selected THIS platform's header:
    // each platform/*.hpp stamps BOOST_PLATFORM with its own string. A config
    // that silently defaulted everywhere would fail on every branch.
#if defined(_WIN32)
    ok = ok && std::string_view(BOOST_PLATFORM) == "Win32";
#elif defined(__APPLE__) && defined(__MACH__)
    ok = ok && std::string_view(BOOST_PLATFORM) == "Mac OS";
#elif defined(__linux__)
    ok = ok && std::string_view(BOOST_PLATFORM) == "linux";
#else
// …

tests/examples/boost-config/tests/config.cpp · 项目 tests/examples/boost-config

构建

targets
boost_config (lib)
language
c++20
import std
no
include dirs
*/include

源文件 (1)

  • mcpp_generated/boost_config_anchor.cpp

生成的文件

  • mcpp_generated/boost_config_anchor.cpp

版本

版本平台 镜像sha256
1.92.0 最新 LinuxWindowsmacOS 源站 b4171037f133…