mcpp index

compat.boost-type-traits

#include

Boost.TypeTraits 1.92.0 — compile-time type introspection traits

#include <boost/type_traits/is_same.hpp>
mcpp add compat.boost-type-traits@1.92.0

用法

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

// Behavioral test: core traits give the right answers, cross-checked against
// the standard library where an equivalent exists.
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/add_pointer.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <type_traits>

int main() {
    static_assert(boost::is_same<int, int>::value, "same type must match");
    static_assert(!boost::is_same<int, long>::value, "distinct types must differ");
    static_assert(std::is_same<boost::add_pointer<int>::type, int*>::value,
                  "add_pointer must yield int*");
    static_assert(std::is_same<boost::remove_cv<const volatile int>::type, int>::value,
                  "remove_cv must strip const/volatile");

    bool ok = boost::is_same<double, double>::value;   // runtime-visible path
    return ok ? 0 : 1;
}

tests/examples/boost-type-traits/tests/type_traits.cpp · 项目 tests/examples/boost-type-traits

构建

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

源文件 (1)

  • mcpp_generated/boost_type_traits_anchor.cpp

生成的文件

  • mcpp_generated/boost_type_traits_anchor.cpp

版本

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