Now avoids the "conditional expression is constant" warning in a more generic way.

[SVN r22552]
This commit is contained in:
Andreas Huber
2004-03-25 23:31:47 +00:00
parent 31d2b2c646
commit c2a03f6340

View File

@@ -167,6 +167,10 @@ namespace
template<>
void FillEventArray< 0 >() {}
////////////////////////////////////////////////////////////////////////////
template< typename T >
T AvoidConstantWarning( T value ) { return value; }
////////////////////////////////////////////////////////////////////////////
template< unsigned int msb, bool display >
void VisitAllStates( BitMachine & bitMachine )
@@ -175,20 +179,11 @@ namespace
bitMachine.process_event( *pFlipBitEvents[ msb ] );
++eventsSentTotal;
#ifdef BOOST_MSVC
# pragma warning( push )
# pragma warning( disable: 4127 ) // conditional expression is constant
#endif
if ( display )
if ( AvoidConstantWarning( display ) )
{
DisplayMachineState( bitMachine );
}
#ifdef BOOST_MSVC
# pragma warning( pop )
#endif
VisitAllStates< msb - 1, display >( bitMachine );
}