Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-06-12 09:51:06


Peter Dimov skrev:
> Thorsten Ottosen:
>> Dear all,
>>
>> I often find myself in the need of the above assertion mechanism where
>> the actual assertion should only checked if the first condition is true.
>>
>> Of course, we could write this as
>>
>> if( IF )
>> BOOST_ASSERT( THEN );
>>
>> but this has the potential downside that the compiler cannot
>> completely optimize away the function calls inside the if-statement.
>
> BOOST_ASSERT( !IF || THEN );
>
> or
>
> BOOST_ASSERT( IF? THEN: true );

yes, but I find that these become anoyingly hard to read.
Don't you?

-Thorsten


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