...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
BOOST_CONTRACT_ASSERT_AUDIT — Preferred way to assert contract conditions that are computationally expensive, at least compared to the computational cost of executing the function body.
// In header: <boost/contract/assert.hpp> BOOST_CONTRACT_ASSERT_AUDIT(cond)
The asserted 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_ASSERT_AUDIT(cond) \ BOOST_CONTRACT_ASSERT(cond) #else #define BOOST_CONTRACT_ASSERT_AUDIT(cond) \ BOOST_CONTRACT_ASSERT(true || cond) #endif
BOOST_CONTRACT_ASSERT_AXIOM are the three assertion levels predefined by this library. If there is a need, programmers are free to implement their own assertion levels defining macros similar to the one above.