summaryrefslogtreecommitdiff
path: root/include/cppunit/tools/Algorithm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cppunit/tools/Algorithm.h')
-rw-r--r--include/cppunit/tools/Algorithm.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/cppunit/tools/Algorithm.h b/include/cppunit/tools/Algorithm.h
new file mode 100644
index 0000000..2eb1c6f
--- /dev/null
+++ b/include/cppunit/tools/Algorithm.h
@@ -0,0 +1,27 @@
+#ifndef CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
+#define CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED
+
+#include <cppunit/Portability.h>
+
+CPPUNIT_NS_BEGIN
+
+template<class SequenceType, class ValueType>
+void
+removeFromSequence( SequenceType &sequence,
+ const ItemType &valueToRemove )
+{
+ Sequence::iterator it = sequence.begin();
+ Sequence::iterator itEnd = sequence.end();
+ while ( it != itEnd )
+ {
+ if ( *it == valueToRemove )
+ it = sequence.erase( it );
+ else
+ ++it;
+ }
+}
+
+CPPUNIT_NS_END
+
+
+#endif // CPPUNIT_TOOLS_ALGORITHM_H_INCLUDED \ No newline at end of file