Boost logo

Boost :

Subject: Re: [boost] [assert] static_assert envy
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2011-01-18 12:06:10


Den 18-01-2011 16:39, Stewart, Robert skrev:

> Perhaps you mean that condition can be used to suppress certain
> assertions (and not others) without, itself, appearing in the
> assertion message? I've never done that, so the value is low for me,
> but perhaps there are good use cases I've overlooked.
>
> If you mean something else entirely, please clarify.

It's to avoid writing

   BOOST_ASSERT( !foo() || assertion )

which in priciple is identical to

  if( foo() )
    BOOST_ASSERT( assertion )

but which is not guaranteed to be removed by the compiler, whereas

  BOOST_ASSERT_IF( foo(), assertion )

is.

-Thorsten


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