Boost logo

Boost :

From: E. Karpachov (jk_at_[hidden])
Date: 2001-03-18 09:59:26


On Sun, Mar 18, 2001 at 09:42:37AM -0500, Beman Dawes wrote:
> So perhaps we need a BOOST_ASSERT(), which has at least three behaviors
> (determined by what preprocessor symbols are defined) when the predicate
> fails:
>
> * classic assert() with -NDEBUG not defined.
>
> * classic assert() with -NDEBUG defined.
>
> * throw logic_error (with file/line info?).
>
> * [possibly?] call some user or system function (with file/line info?).
>
> Note that the use of BOOST_ASSERT() would be part of the function's
> interface (rather than just QOI) because user code may rely on some of the
> behavior choices.
>
> Comments?

The function could be templated with error-processing policy class. Different
policies could do the same things as you wrote, and some other. (As far as I
know, this technique was proposed by A.Alexandrescu - or, may be, I'm wrong
about this).

-- 
jk

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk