19#include <boost/assert.hpp>
27#ifndef BOOST_ASSERT_IS_VOID
59 BOOST_ASSERT_MSG( (
obj_->*
fun_)(),
"invariant violated" );
69#ifndef BOOST_ASSERT_IS_VOID
70# define DBC_INV_RAII(TT) const DbCRAIIassert<TT> _destructmeatreturn( &TT::invariant, this )
73# define DBC_INV_RAII(TT) ((void)0)
77#define DBC_PRE(XXX) BOOST_ASSERT(XXX)
80#define DBC_POST(XXX) BOOST_ASSERT(XXX)
83#define DBC_INV BOOST_ASSERT(invariant())
88#define DBC_INV_CTOR(T) BOOST_ASSERT(T::invariant())
Helper class to call a check always at function return.
Definition: dbc.h:41
~DbCRAIIassert()
Dtor.
Definition: dbc.h:58
bool(T::*)() const noexcept assert_t
A shortcut for the invariant() function pointers.
Definition: dbc.h:43
DbCRAIIassert(assert_t p_fun, T *p_obj)
Ctor.
Definition: dbc.h:53
const T * obj_
The this of the invariant function.
Definition: dbc.h:49
const assert_t fun_
The invariant() of the current class to be called at function return.
Definition: dbc.h:46
Design by contract interface class.
Definition: dbc.h:25
virtual bool invariant() const noexcept
Checks the invariants of the class in which it is defined.
Definition: dbc.h:31