...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
BOOST_CONTRACT_EXCEPT — Program exception guarantees that can be completely disabled at compile-time.
// In header: <boost/contract_macro.hpp>
BOOST_CONTRACT_EXCEPT(...)
BOOST_CONTRACT_EXCEPT(f)
expands to code equivalent to the following (note that no code is generated when BOOST_CONTRACT_NO_EXCEPTS
is defined):
#ifndef BOOST_CONTRACT_NO_EXCEPTS .except(f) #endif
Where:
f
is the nullary functor called by this library to check exception guarantees 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::except_failure
). This functor should capture variables by (constant) references (to access the values they will have at function exit). (This is a variadic macro parameter so it can contain commas not protected by round parenthesis.)
See Also:
Disable Contract Compilation, Exception Guarantees