Home | Libraries | People | FAQ | More |
BOOST_CONTRACT_POSTCONDITION — Program postconditions that can be completely disabled at compile-time.
// In header: <boost/contract_macro.hpp>
BOOST_CONTRACT_POSTCONDITION(...)
BOOST_CONTRACT_POSTCONDITION(f)
expands to code equivalent to the following (note that no code is generated when BOOST_CONTRACT_NO_POSTCONDITIONS
is defined):
#ifndef BOOST_CONTRACT_NO_POSTCONDITIONS .postcondition(f) #endif
Where:
f
is the functor called by this library to check postconditions f(...)
. Assertions within this functor are usually programmed using BOOST_CONTRACT_ASSERT
, but any exception thrown by a call to this functor indicates a contract assertion failure (and will result in this library calling boost::contract::postcondition_failure
). This functor should capture variables by (constant) references (to access the values they will have at function exit). This functor takes the return value (preferably by const&
) as its one single parameter but only for virtual public functions and public functions overrides, otherwise it takes no parameter. (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)
See Also:
Disable Contract Compilation, Postconditions