Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
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(...);
    ...
}

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, BOOST_CONTRACT_CHECK((cond)) will always work.)


PrevUpHomeNext