started advanced topics section in the docs

This commit is contained in:
Lorenzo Caminiti
2015-06-27 08:03:34 -07:00
parent be3a974847
commit 2fb2ddc367
125 changed files with 2979 additions and 3114 deletions

View File

@@ -50,12 +50,12 @@ struct call_if_statement<true, Then, R> { // Copyable as *.
R else_(Else const&) const { return *r_; }
template<bool ElseIfCond, typename ElseIfThen>
call_if_statement<true, Then, R> else_if_c(ElseIfThen const&) {
call_if_statement<true, Then, R> else_if_c(ElseIfThen const&) const {
return *this;
}
template<class ElseIfCond, typename ElseIfThen>
call_if_statement<true, Then, R> else_if(ElseIfThen const&) {
call_if_statement<true, Then, R> else_if(ElseIfThen const&) const {
return *this;
}
@@ -74,12 +74,12 @@ struct call_if_statement<true, Then, void> {
void else_(Else const&) const {}
template<bool ElseIfCond, typename ElseIfThen>
call_if_statement<true, Then, void> else_if_c(ElseIfThen const&) {
call_if_statement<true, Then, void> else_if_c(ElseIfThen const&) const {
return *this;
}
template<class ElseIfCond, typename ElseIfThen>
call_if_statement<true, Then, void> else_if(ElseIfThen const&) {
call_if_statement<true, Then, void> else_if(ElseIfThen const&) const {
return *this;
}
};
@@ -101,12 +101,13 @@ struct call_if_statement<false, Then, boost::contract::aux::none> {
}
template<bool ElseIfCond, typename ElseIfThen>
call_if_statement<ElseIfCond, ElseIfThen> else_if_c(ElseIfThen f) {
call_if_statement<ElseIfCond, ElseIfThen> else_if_c(ElseIfThen f) const {
return call_if_statement<ElseIfCond, ElseIfThen>(f);
}
template<class ElseIfCond, typename ElseIfThen>
call_if_statement<ElseIfCond::value, ElseIfThen> else_if(ElseIfThen f) {
call_if_statement<ElseIfCond::value, ElseIfThen> else_if(ElseIfThen f)
const {
return call_if_statement<ElseIfCond::value, ElseIfThen>(f);
}
};

View File

@@ -4,6 +4,18 @@
/** @file */
#ifndef BOOST_CONTRACT_CONFIG_NO_PRECONDITIONS
# define BOOST_CONTRACT_CONFIG_NO_PRECONDITIONS 0
#endif
#ifndef BOOST_CONTRACT_CONFIG_NO_POSTCONDITIONS
# define BOOST_CONTRACT_CONFIG_NO_POSTCONDITIONS 0
#endif
#ifndef BOOST_CONTRACT_CONFIG_NO_INVARIANTS
# define BOOST_CONTRACT_CONFIG_NO_INVARIANTS 0
#endif
// TODO: base_types, invariant, and static_invariant must be public. Allow to
// make them private (so to not alter user's public API) by declaring some
// `friend class boost::contract::aux::access;` from the user's class (then

View File

@@ -81,18 +81,21 @@ namespace exception_ {
s = "precondition "; break;
case post_key:
s = "postcondition "; break;
// NOTE: Following only needs to distinguish between entry and
// exit invariant (const, volatile, static, etc. can already be
// distinguished by code around assertion failure line number).
case const_entry_inv_key:
s = "const entry invariant "; break;
s = "entry invariant "; break;
case const_volatile_entry_inv_key:
s = "const volatile entry invariant "; break;
s = "entry invariant "; break;
case static_entry_inv_key:
s = "static entry invariant "; break;
s = "entry invariant "; break;
case const_exit_inv_key:
s= "const exit invariant "; break;
s= "exit invariant "; break;
case const_volatile_exit_inv_key:
s= "const volatile exit invariant "; break;
s= "exit invariant "; break;
case static_exit_inv_key:
s = "static exit invariant "; break;
s = "exit invariant "; break;
// No default (so compiler warning/error on missing enum case).
}
try {
@@ -296,6 +299,10 @@ void set_invariant_failed(assertion_failed_handler f)
set_exit_invariant_failed(f);
}
// TODO: Simplify the invariant failure handlers. I only need two, one for
// entry_inv and one for exit_inv (I do not need to distinguish volatile,
// const, static... they are all inv).
} } // namespace
#endif // #include guard