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…