completed first revised draft of docs

This commit is contained in:
Lorenzo Caminiti
2015-06-30 17:56:22 -07:00
parent 2fb2ddc367
commit f42662e44c
58 changed files with 1048 additions and 3062 deletions

View File

@@ -0,0 +1,21 @@
//[free_function
#include <boost/contract.hpp>
int inc(int& x) {
int result;
boost::shared_ptr<int const> old_x = BOOST_CONTRACT_OLDOF(x);
boost::contract::guard c = boost::contract::function()
.precondition([&] {
BOOST_CONTRACT_ASSERT(x < std::numberic_limits<int>::max());
})
.postcondition([&] {
BOOST_CONTRACT_ASSERT(x == *old_x + 1);
BOOST_CONTRACT_ASSERT(result == *old_x);
})
;
return result = x++; // Function body.
}
//]