diff --git a/gsl/gsl_algorithm b/gsl/gsl_algorithm index 3e6b353..c77e258 100644 --- a/gsl/gsl_algorithm +++ b/gsl/gsl_algorithm @@ -113,6 +113,19 @@ auto upper_bound(const span& rng, const T& value, Com return details_algo::toIt(rng, ptr); } +// binary_search +template +bool binary_search(span rng, const T& value) +{ + return std::binary_search(rng.data(), rng.data() + rng.size(), value); +} + +template +bool binary_search(span rng, const T& value, Compare comp) +{ + return std::binary_search(rng.data(), rng.data() + rng.size(), value, comp); +} + } // namespace gsl #ifdef _MSC_VER