diff --git a/gsl/gsl_algorithm b/gsl/gsl_algorithm index c77e258..fc5b101 100644 --- a/gsl/gsl_algorithm +++ b/gsl/gsl_algorithm @@ -126,6 +126,32 @@ bool binary_search(span rng, const T& value, Compare return std::binary_search(rng.data(), rng.data() + rng.size(), value, comp); } +// sort +template +void sort(span rng) +{ + std::sort(rng.data(), rng.data() + rng.size()); +} + +template +void sort(span rng, Compare comp) +{ + std::sort(rng.data(), rng.data() + rng.size(), comp); +} + +// stable sort +template +void stable_sort(span rng) +{ + std::stable_sort(rng.data(), rng.data() + rng.size()); +} + +template +void stable_sort(span rng, Compare comp) +{ + std::stable_sort(rng.data(), rng.data() + rng.size(), comp); +} + } // namespace gsl #ifdef _MSC_VER