mcpp index

compat.boost-assert

#include

Boost.Assert 1.92.0 — configurable assert macros with source-location support

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

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

// Behavioral test: BOOST_VERIFY's expression is evaluated in ALL build modes
// (unlike BOOST_ASSERT, which compiles away under NDEBUG), and the
// source_location / current_function utilities return live data.
#include <boost/assert.hpp>
#include <boost/assert/source_location.hpp>
#include <boost/current_function.hpp>

static int answer() { return 42; }

int main() {
    bool ran = false;
    BOOST_VERIFY(answer() == 42 && (ran = true));   // must run even under NDEBUG

    const char* fn = BOOST_CURRENT_FUNCTION;
    bool fn_ok = fn != nullptr && *fn != '\0';

    constexpr boost::source_location loc = BOOST_CURRENT_LOCATION;
    bool loc_ok = loc.file_name() != nullptr && loc.line() > 0;

    return (ran && fn_ok && loc_ok) ? 0 : 1;
}

tests/examples/boost-assert/tests/assert.cpp · 專案 tests/examples/boost-assert

建置

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

原始檔 (1)

  • mcpp_generated/boost_assert_anchor.cpp

產生的檔案

  • mcpp_generated/boost_assert_anchor.cpp

版本

版本平台 鏡像sha256
1.92.0 最新 LinuxWindowsmacOS 來源 8d49fc69df12…