20#include <boost/assert.hpp>
28#ifndef BOOST_ASSERT_IS_VOID
60 BOOST_ASSERT_MSG( (
obj_->*
fun_)(),
"invariant violated" );
70#ifndef BOOST_ASSERT_IS_VOID
71# define DBC_INV_RAII(TT) const DbCRAIIassert<TT> _destructmeatreturn( &TT::invariant, this )
74# define DBC_INV_RAII(TT) ((void)0)
78#define DBC_PRE(XXX) BOOST_ASSERT(XXX)
81#define DBC_POST(XXX) BOOST_ASSERT(XXX)
84#define DBC_INV BOOST_ASSERT(invariant())
89#define DBC_INV_CTOR(T) BOOST_ASSERT(T::invariant())
Helper class to call a check always at function return.
Definition dbc.h:42
~DbCRAIIassert()
Dtor.
Definition dbc.h:59
bool(T::*)() const noexcept assert_t
A shortcut for the invariant() function pointers.
Definition dbc.h:44
DbCRAIIassert(assert_t p_fun, T *p_obj)
Ctor.
Definition dbc.h:54
const T * obj_
The this of the invariant function.
Definition dbc.h:50
const assert_t fun_
The invariant() of the current class to be called at function return.
Definition dbc.h:47
Design by contract interface class.
Definition dbc.h:26
virtual bool invariant() const noexcept
Checks the invariants of the class in which it is defined.
Definition dbc.h:32