[Scummvm-cvs-logs] SF.net SVN: scummvm:[46619] scummvm/trunk/test/common/algorithm.h
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Dec 27 12:05:44 CET 2009
Revision: 46619
http://scummvm.svn.sourceforge.net/scummvm/?rev=46619&view=rev
Author: lordhoto
Date: 2009-12-27 11:05:43 +0000 (Sun, 27 Dec 2009)
Log Message:
-----------
More cleanup.
Modified Paths:
--------------
scummvm/trunk/test/common/algorithm.h
Modified: scummvm/trunk/test/common/algorithm.h
===================================================================
--- scummvm/trunk/test/common/algorithm.h 2009-12-27 11:05:22 UTC (rev 46618)
+++ scummvm/trunk/test/common/algorithm.h 2009-12-27 11:05:43 UTC (rev 46619)
@@ -22,14 +22,11 @@
struct Item {
int value;
Item(int v) : value(v) {}
- };
- struct ItemCmp {
- bool operator()(const Item &a, const Item &b) {
- return a.value < b.value;
+ bool operator<(const Item &r) const {
+ return value < r.value;
}
};
-
public:
void test_pod_sort() {
{
@@ -37,7 +34,8 @@
Common::sort(array, array + ARRAYSIZE(array));
checkSort(array, array + ARRAYSIZE(array), Common::Less<int>());
- Common::sort(array, array + ARRAYSIZE(array)); //already sorted one
+ // already sorted
+ Common::sort(array, array + ARRAYSIZE(array));
checkSort(array, array + ARRAYSIZE(array), Common::Less<int>());
}
{
@@ -57,12 +55,12 @@
for(int i = 0; i < n; ++i)
list.push_back(Item(i * 0xDEADBEEF % 1337));
- Common::sort(list.begin(), list.end(), ItemCmp());
- checkSort(list.begin(), list.end(), ItemCmp());
+ Common::sort(list.begin(), list.end(), Common::Less<Item>());
+ checkSort(list.begin(), list.end(), Common::Less<Item>());
- //already sorted
- Common::sort(list.begin(), list.end(), ItemCmp());
- checkSort(list.begin(), list.end(), ItemCmp());
+ // already sorted
+ Common::sort(list.begin(), list.end(), Common::Less<Item>());
+ checkSort(list.begin(), list.end(), Common::Less<Item>());
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list