diff options
-rw-r--r-- | common/algorithm.h | 6 | ||||
-rw-r--r-- | common/list_intern.h | 1 | ||||
-rw-r--r-- | test/common/algorithm.h | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/common/algorithm.h b/common/algorithm.h index d730a3ada2..4a2acef7a5 100644 --- a/common/algorithm.h +++ b/common/algorithm.h @@ -216,8 +216,10 @@ void sort(T *first, T *last) { 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 diff --git a/common/list_intern.h b/common/list_intern.h index 11d03fd6ff..b7fbaffc47 100644 --- a/common/list_intern.h +++ b/common/list_intern.h @@ -53,6 +53,7 @@ namespace ListInternal { typedef Node<T> * NodePtr; typedef T & ValueRef; typedef T * ValuePtr; + typedef T ValueType; NodeBase *_node; diff --git a/test/common/algorithm.h b/test/common/algorithm.h index bb2932178d..ed87d6850d 100644 --- a/test/common/algorithm.h +++ b/test/common/algorithm.h @@ -76,7 +76,7 @@ public: 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); } }; |