Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Macro BOOST_CONTRACT_CHECK

BOOST_CONTRACT_CHECK — Preferred way to assert implementation check conditions.

Synopsis

// In header: <boost/contract/core/check_macro.hpp>

BOOST_CONTRACT_CHECK(cond)

Description

It is preferred to use this macro instead of programming implementation checks in a nullary functor passed to boost::contract::check constructor because this macro will completely remove implementation checks from the code when BOOST_CONTRACT_NO_CHECKS is defined:

void f() {
    ...
    BOOST_CONTRACT_CHECK(cond);
    ...
}

BOOST_CONTRACT_CHECK, BOOST_CONTRACT_CHECK_AUDIT, and BOOST_CONTRACT_CHECK_AXIOM are the three assertion levels predefined by this library for implementation checks.

See Also:

Implementation Checks

Parameters:

cond

Boolean condition to check within implementation code (function body, etc.). (This is not a variadic macro parameter so any comma it might contain must be protected by round parenthesis and BOOST_CONTRACT_CHECK((cond)) will always work.)


PrevUpHomeNext