[Scummvm-cvs-logs] SF.net SVN: scummvm:[46644] scummvm/trunk

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Dec 27 15:13:39 CET 2009


Revision: 46644
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46644&view=rev
Author:   megath
Date:     2009-12-27 14:13:39 +0000 (Sun, 27 Dec 2009)

Log Message:
-----------
allowed list to be sorted with default comparator

Modified Paths:
--------------
    scummvm/trunk/common/algorithm.h
    scummvm/trunk/common/list_intern.h
    scummvm/trunk/test/common/algorithm.h

Modified: scummvm/trunk/common/algorithm.h
===================================================================
--- scummvm/trunk/common/algorithm.h	2009-12-27 14:11:26 UTC (rev 46643)
+++ scummvm/trunk/common/algorithm.h	2009-12-27 14:13:39 UTC (rev 46644)
@@ -216,9 +216,11 @@
 	sort(first, last, Common::Less<T>());
 }
 
-///\todo add value_type to all iterators and add default sort variant with Common::Less<T::value_type>()
+template<class T>
+void sort(T first, T last) {
+	sort(first, last, Common::Less<typename T::ValueType>());
+}
 
-
 } // End of namespace Common
 #endif
 

Modified: scummvm/trunk/common/list_intern.h
===================================================================
--- scummvm/trunk/common/list_intern.h	2009-12-27 14:11:26 UTC (rev 46643)
+++ scummvm/trunk/common/list_intern.h	2009-12-27 14:13:39 UTC (rev 46644)
@@ -53,6 +53,7 @@
 		typedef Node<T> *	NodePtr;
 		typedef T &			ValueRef;
 		typedef T *			ValuePtr;
+		typedef T			ValueType;
 
 		NodeBase *_node;
 

Modified: scummvm/trunk/test/common/algorithm.h
===================================================================
--- scummvm/trunk/test/common/algorithm.h	2009-12-27 14:11:26 UTC (rev 46643)
+++ scummvm/trunk/test/common/algorithm.h	2009-12-27 14:13:39 UTC (rev 46644)
@@ -76,7 +76,7 @@
 		TS_ASSERT_EQUALS(checkSort(list.begin(), list.end(), Common::Less<Item>()), true);
 
 		// already sorted
-		Common::sort(list.begin(), list.end(), Common::Less<Item>());
+		Common::sort(list.begin(), list.end());
 		TS_ASSERT_EQUALS(checkSort(list.begin(), list.end(), Common::Less<Item>()), true);
 	}
 };


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