Algorithm.h 533 B

1234567891011121314151617181920212223
  1. #ifndef CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
  2. #define CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
  3. #include <cppunit/Portability.h>
  4. CPPUNIT_NS_BEGIN
  5. template<class SequenceType, class ValueType>
  6. void
  7. removeFromSequence( SequenceType &sequence,
  8. const ValueType &valueToRemove )
  9. {
  10. for ( unsigned int index =0; index < sequence.size(); ++index )
  11. {
  12. if ( sequence[ index ] == valueToRemove )
  13. sequence.erase( sequence.begin() + index );
  14. }
  15. }
  16. CPPUNIT_NS_END
  17. #endif // CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED