|  | Home | Libraries | People | FAQ | More | 
boost::contract::public_function — Program contracts for void virtual public functions that do not override.
// In header: <boost/contract/public_function.hpp> template<typename Class> specify_precondition_old_postcondition_except public_function(virtual_ * v, Class * obj);
This is used to specify preconditions, postconditions, exception guarantees, old value copies at body, and check class invariants for public functions that are virtual, do not override, and return void: 
class u { friend class boost::contract::access; void invariant() const { // Optional (as for static and volatile). BOOST_CONTRACT_ASSERT(...); ... } public: void f(..., boost::contract::virtual_* v = 0) { boost::contract::old_ptr<old_type> old_var; boost::contract::check c = boost::contract::public_function(v, this) .precondition([&] { // Optional. BOOST_CONTRACT_ASSERT(...); ... }) .old([&] { // Optional. old_var = BOOST_CONTRACT_OLDOF(v, old_expr); ... }) .postcondition([&] { // Optional. BOOST_CONTRACT_ASSERT(...); ... }) .except([&] { // Optional. BOOST_CONTRACT_ASSERT(...); ... }) ; ... // Function body. } ... };
A virtual public function should always call  boost::contract::public_function
See Also:
| Parameters: | 
 | ||||
| Template Parameters: | 
 | ||||
| Returns: | The result of this function must be assigned to a variable of type   |