
6 May
2009
6 May
'09
8:16 a.m.
Scott McMurray skrev:
On Tue, May 5, 2009 at 20:11, Richard Holden <aciddeath@gmail.com> wrote:
Could you provide an usage example please, I understand the macro but I don't understand the usage pattern.
Perhaps something like this?
BOOST_ASSERT_IF( !c.empty(), *c.begin() < *c.rbegin() );
Perhaps it would be better named BOOST_ASSERT_IMPLIES?
It's an implication allright, but also an "if" :-) : if( IF ) BOOST_ASSERT( X ); The usage is whenever you want to make an assertion conditional on something. It happens quite frequent. And you cannot write the if statement above if you want to be sure the whole thing is optimized away, therefore the new macro. -Thorsten