]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/algorithm.h
Add whole-container versions of sort and stable_sort
[libs/core.git] / source / core / algorithm.h
index 69ec390908793a7e299cba81115b30c93e68cc79..63d1cf4cce7d33e45a6cda0355e0a536b778b964 100644 (file)
@@ -29,6 +29,30 @@ inline typename Container::const_iterator find_if(const Container &cont, Predica
        return std::find_if(cont.begin(), cont.end(), pred);
 }
 
        return std::find_if(cont.begin(), cont.end(), pred);
 }
 
+template<typename Container>
+inline void sort(Container &cont)
+{
+       std::sort(cont.begin(), cont.end());
+}
+
+template<typename Container, typename Predicate>
+inline void sort(Container &cont, Predicate pred)
+{
+       std::sort(cont.begin(), cont.end(), pred);
+}
+
+template<typename Container>
+inline void stable_sort(Container &cont)
+{
+       std::stable_sort(cont.begin(), cont.end());
+}
+
+template<typename Container, typename Predicate>
+inline void stable_sort(Container &cont, Predicate pred)
+{
+       std::stable_sort(cont.begin(), cont.end(), pred);
+}
+
 } // namespace Msp
 
 #endif
 } // namespace Msp
 
 #endif