Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2001-03-18 06:24:12

>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).

I don't think this is a good idea. If you did this you would force
clients to templatize their classes if they wanted to support
customizeable asserts. Better to rely on the preprocessor or function

  -- Jesse

Boost list run by bdawes at, gregod at, cpdaniel at, john at