CppUnit - The Unit Testing Library

CppUnit project page | FAQ

Algorithm.h
Go to the documentation of this file.
1 #ifndef CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
2 #define CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
3
4 #include <cppunit/Portability.h>
5
6 CPPUNIT_NS_BEGIN
7
8 template<class SequenceType, class ValueType>
9 void
10 removeFromSequence( SequenceType &sequence,
11 const ValueType &valueToRemove )
12 {
13 for ( unsigned int index =0; index < sequence.size(); ++index )
14 {
15 if ( sequence[ index ] == valueToRemove )
16 sequence.erase( sequence.begin() + index );
17 }
18 }
19
20 CPPUNIT_NS_END
21
22
23 #endif // CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
Portability.h
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition: Portability.h:120
removeFromSequence
CPPUNIT_NS_BEGIN void removeFromSequence(SequenceType &sequence, const ValueType &valueToRemove)
Definition: Algorithm.h:10
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition: Portability.h:119

| Send comments to: CppUnit Developers