Boost logo

Boost :

Subject: Re: [boost] [assert] Assert library? - Was: [regression]Where'sboost/assert.hpp ??
From: Peter Dimov (lists_at_[hidden])
Date: 2014-03-01 06:44:08


Andrey Semashev wrote:
> Leaving the note about usefulness of this warning aside, you could work
> around it e.g. by using preprocessor tricks:
>
> #define BOOST_ASSERTL(expr, level)\
> BOOST_ASSERTL_ ## level(expr)

I'd thought of that. But it works only if level is a number token or a macro
expanding to a number token, and the implementation can no longer not care
what the levels are, it has to list them as BOOST_ASSERTL_0 and so on.

> or template specialization:
>
> #define BOOST_ASSERTL(expr, level)\
> assert_impl< (level) <= BOOST_ASSERT_LEVEL >::do((expr), #expr,
> __FILE__, __LINE__)

This will still evaluate 'expr'.


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