mcpp index

compat.boost-any

#include

Boost.Any 1.92.0 — a type-safe container for single values of different types

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

用法

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

#include <boost/any.hpp>

#include <string>

int main() {
    boost::any value = 42;
    if (value.empty()) return 1;
    if (boost::any_cast<int>(value) != 42) return 1;

    value = std::string("muduo");
    const auto* text = boost::any_cast<std::string>(&value);
    if (text == nullptr || *text != "muduo") return 1;

    value.clear();
    return value.empty() ? 0 : 1;
}

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

构建

targets
boost_any (lib)
language
c++23
import std
no
include dirs
*/include

源文件 (1)

  • mcpp_generated/boost_any_anchor.cpp

生成的文件

  • mcpp_generated/boost_any_anchor.cpp

版本

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