From 9d202f81f7080335b59ad1a5ab1d034634052a65 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 25 Mar 2018 14:28:10 +0300 Subject: [PATCH] Add whole-container versions of sort and stable_sort --- source/core/algorithm.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 -- 2.45.2