summaryrefslogtreecommitdiff
path: root/include/cppunit/tools/Algorithm.h
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2003-03-11 19:19:53 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2003-03-11 19:19:53 +0000
commitcae3d20badb7edef6de1cda979c719bd0d65b655 (patch)
treeb14ca8ed129bc146d112d8e57186dcacd08bc419 /include/cppunit/tools/Algorithm.h
parent4ca86cd4fd9b7a8c2dd60c1b62724b18b7bd5ec7 (diff)
downloadcppunit-cae3d20badb7edef6de1cda979c719bd0d65b655.tar.gz
Include/cppunit/tools/Algorithm.
include/cppunit/tools/Algorithm.h: * src/cppunit/TestResult.cpp: * src/msvc6/testrunner/TestRunnerModel.cpp: added removeFromSequence algorithm in Algorithm.h to fix STLPort compatibility issue (std::remove use the one of cstdio instead of algorithm). Bug #694971. * include/cppunit/extensions/TestNamer.h: fixed bug #662666 (missing include for typeinfo). * src/cppunit/TestResult.cpp: TestFailure are no longer passed as temporary, but explicitely instantiated on the stack. Work around AIX compiler bug.
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