Boost logo

Boost :

Subject: [boost] [string_algo] first_finderF hoist empty check out of loop
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-04-04 15:35:11

In trying to get string algorithm icontains to work with spirit's
file_iterator (which I still haven't been successful with) I noticed
that the check for an empty search string is in side the loop. As:

// Outer loop
for(input_iterator_type OuterIt=Begin;
     // Sanity check
     if( boost::empty(m_Search) )
         return result_type( End, End );

Wouldn't it be better to hoist this check out of the loop and only do it

Thanks, Jeff

Boost list run by bdawes at, gregod at, cpdaniel at, john at