...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::specify_precondition_old_postcondition_except — Allow to specify preconditions, old value copies at body, postconditions, and exception guarantees.
// In header: <boost/contract/core/specify.hpp> template<typename VirtualResult = void> class specify_precondition_old_postcondition_except { public: // construct/copy/destruct ~specify_precondition_old_postcondition_except(); // public member functions template<typename F> specify_old_postcondition_except< VirtualResult > precondition(F const &); template<typename F> specify_postcondition_except< VirtualResult > old(F const &); template<typename F> specify_except postcondition(F const &); template<typename F> specify_nothing except(F const &); };
Allow to specify functors this library will call to check preconditions, copy old values at body, check postconditions, and check exception guarantees. This object is internally constructed by this library when users specify contracts calling boost::contract::function
and similar functions (that is why this class does not have a public constructor).
See Also:
Preconditions, Old Value Copies at Body, Postconditions, Exception Guarantees
typename VirtualResult = void
Return type of the enclosing function declaring the contract if that function is either a virtual public function or a public function override. Otherwise, this type is always void
.
specify_precondition_old_postcondition_except
public
construct/copy/destruct~specify_precondition_old_postcondition_except();Destruct this object.
Throws: This can throw in case programmers specify failure handlers that throw exceptions instead of terminating the program (see
Throw on Failure). (This is declared noexcept(false)
since C++11.)
specify_precondition_old_postcondition_except
public member functionstemplate<typename F> specify_old_postcondition_except< VirtualResult > precondition(F const & f);Allow to specify preconditions.
Parameters: |
|
||
Returns: |
After preconditions have been specified, the object returned by this function allows to optionally specify old value copies at body, postconditions, and exception guarantees. |
template<typename F> specify_postcondition_except< VirtualResult > old(F const & f);Allow to specify old value copies at body.
It should often be sufficient to initialize old value pointers as soon as they are declared, without using this function (see Old Value Copies at Body).
Parameters: |
|
||
Returns: |
After old value copies at body have been specified, the object returned by this functions allows to optionally specify postconditions and exception guarantees. |
template<typename F> specify_except postcondition(F const & f);Allow to specify postconditions.
Parameters: |
|
||
Returns: |
After postconditions have been specified, the object returned by this function allows to optionally specify exception guarantees. |
template<typename F> specify_nothing except(F const & f);Allow to specify exception guarantees.
Parameters: |
|
||
Returns: |
After exception guarantees have been specified, the object returned by this function does not allow to specify any additional contract. |