aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-12-27 13:58:00 +0000
committerJohannes Schickel2009-12-27 13:58:00 +0000
commit69ba1ee04d537c95b5dfc4d57506f7278ebdc94e (patch)
treee39e2df4a1dc0f51b765573a2549df25e19ee5df
parentcddb95d9c3fa57ccb4b73f5b697129d13efe00f8 (diff)
downloadscummvm-rg350-69ba1ee04d537c95b5dfc4d57506f7278ebdc94e.tar.gz
scummvm-rg350-69ba1ee04d537c95b5dfc4d57506f7278ebdc94e.tar.bz2
scummvm-rg350-69ba1ee04d537c95b5dfc4d57506f7278ebdc94e.zip
Some more code format fixes.
svn-id: r46641
-rw-r--r--common/algorithm.h23
1 files changed, 10 insertions, 13 deletions
diff --git a/common/algorithm.h b/common/algorithm.h
index 4224ef0e90..d730a3ada2 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -147,13 +147,13 @@ Op for_each(In first, In last, Op f) {
}
template<typename T>
-unsigned distance(T * first, T * last) {
+unsigned int distance(T *first, T *last) {
return last - first;
}
template<typename T>
-unsigned distance(T first, T last) {
- unsigned n = 0;
+unsigned int distance(T first, T last) {
+ unsigned int n = 0;
while (first != last) {
++n;
++first;
@@ -162,13 +162,13 @@ unsigned distance(T first, T last) {
}
template<typename T>
-T * _sort_choose_pivot(T * first, T * last) {
+T *sortChoosePivot(T *first, T *last) {
return first + distance(first, last) / 2;
}
template<typename T>
-T _sort_choose_pivot(T first, T last) {
- unsigned n = distance(first, last);
+T sortChoosePivot(T first, T last) {
+ unsigned int n = distance(first, last);
n /= 2;
while (n--)
++first;
@@ -176,7 +176,7 @@ T _sort_choose_pivot(T first, T last) {
}
template<typename T, class StrictWeakOrdering>
-T _sort_partition(T first, T last, T pivot, StrictWeakOrdering &comp) {
+T sortPatition(T first, T last, T pivot, StrictWeakOrdering &comp) {
--last;
SWAP(*pivot, *last);
@@ -197,25 +197,22 @@ T _sort_partition(T first, T last, T pivot, StrictWeakOrdering &comp) {
* Simple sort function, modeled after std::sort.
* It compares data with the given comparator object comp.
*/
-
template<typename T, class StrictWeakOrdering>
void sort(T first, T last, StrictWeakOrdering comp) {
if (first == last)
return;
- T pivot = _sort_choose_pivot(first, last);
- pivot = _sort_partition(first, last, pivot, comp);
+ T pivot = sortChoosePivot(first, last);
+ pivot = sortPatition(first, last, pivot, comp);
sort<T, StrictWeakOrdering>(first, pivot, comp);
sort<T, StrictWeakOrdering>(++pivot, last, comp);
}
/**
* Simple sort function, modeled after std::sort.
- * Use it like this: sort(container.begin(), container.end()).
*/
-
template<typename T>
-void sort(T * first, T * last) {
+void sort(T *first, T *last) {
sort(first, last, Common::Less<T>());
}