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_AUDIT

BOOST_CONTRACT_CHECK_AUDIT — Preferred way to assert implementation check conditions that are computationally expensive, at least compared to the computational cost of executing the function body.

Synopsis

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

BOOST_CONTRACT_CHECK_AUDIT(cond)

Description

The specified condition will always be compiled and validated syntactically, but it will not be checked at run-time unless BOOST_CONTRACT_AUDITS is defined (undefined by default). This macro is defined by code equivalent to:

#ifdef BOOST_CONTRACT_AUDITS
    #define BOOST_CONTRACT_CHECK_AUDIT(cond) \
        BOOST_CONTRACT_CHECK(cond)
#else
    #define BOOST_CONTRACT_CHECK_AUDIT(cond) \
        BOOST_CONTRACT_CHECK(true || cond)
#endif

BOOST_CONTRACT_CHECK, BOOST_CONTRACT_CHECK_AUDIT, and BOOST_CONTRACT_CHECK_AXIOM are the three assertion levels predefined by this library for implementation checks. If there is a need, programmers are free to implement their own assertion levels defining macros similar to the one above.

See Also:

Assertion Levels

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


PrevUpHomeNext