From: Mikko Rasa Date: Sun, 25 Mar 2018 11:28:10 +0000 (+0300) Subject: Add whole-container versions of sort and stable_sort X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9d202f81f7080335b59ad1a5ab1d034634052a65;p=libs%2Fcore.git Add whole-container versions of sort and stable_sort --- diff --git a/source/core/algorithm.h b/source/core/algorithm.h index 69ec390..63d1cf4 100644 --- a/source/core/algorithm.h +++ b/source/core/algorithm.h @@ -29,6 +29,30 @@ inline typename Container::const_iterator find_if(const Container &cont, Predica 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