]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/algorithm.h
Use the new utilities to format some strings
[libs/core.git] / source / core / algorithm.h
index 5d75763d2617697fcf3b009e587ce84a4b327a42..63d1cf4cce7d33e45a6cda0355e0a536b778b964 100644 (file)
@@ -6,29 +6,53 @@
 namespace Msp {
 
 template<typename Container, typename T>
-typename Container::iterator find(Container &cont, const T &value)
+inline typename Container::iterator find(Container &cont, const T &value)
 {
        return std::find(cont.begin(), cont.end(), value);
 }
 
 template<typename Container, typename T>
-typename Container::const_iterator find(const Container &cont, const T &value)
+inline typename Container::const_iterator find(const Container &cont, const T &value)
 {
        return std::find(cont.begin(), cont.end(), value);
 }
 
 template<typename Container, typename Predicate>
-typename Container::iterator find_if(Container &cont, Predicate pred)
+inline typename Container::iterator find_if(Container &cont, Predicate pred)
 {
        return std::find_if(cont.begin(), cont.end(), pred);
 }
 
 template<typename Container, typename Predicate>
-typename Container::const_iterator find_if(const Container &cont, Predicate pred)
+inline typename Container::const_iterator find_if(const Container &cont, Predicate 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