X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Falgorithm.h;h=63d1cf4cce7d33e45a6cda0355e0a536b778b964;hp=5d75763d2617697fcf3b009e587ce84a4b327a42;hb=9d202f81f7080335b59ad1a5ab1d034634052a65;hpb=8ac74c1f54ccedb86b4cd1544e2251682c0e95c8 diff --git a/source/core/algorithm.h b/source/core/algorithm.h index 5d75763..63d1cf4 100644 --- a/source/core/algorithm.h +++ b/source/core/algorithm.h @@ -6,29 +6,53 @@ namespace Msp { template -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::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::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::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 +inline void sort(Container &cont) +{ + std::sort(cont.begin(), cont.end()); +} + +template +inline void sort(Container &cont, Predicate pred) +{ + std::sort(cont.begin(), cont.end(), pred); +} + +template +inline void stable_sort(Container &cont) +{ + std::stable_sort(cont.begin(), cont.end()); +} + +template +inline void stable_sort(Container &cont, Predicate pred) +{ + std::stable_sort(cont.begin(), cont.end(), pred); +} + } // namespace Msp #endif