From 9d7a4839b9c016cf1dc055881fd9cca66bc8500b Mon Sep 17 00:00:00 2001 From: Werner Henze Date: Fri, 16 Feb 2018 23:05:44 +0100 Subject: [PATCH] #621 on MSVC use copy_n with stdext::make_checked_array_iterator --- include/gsl/gsl_algorithm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/gsl/gsl_algorithm b/include/gsl/gsl_algorithm index 710792f..2913a81 100644 --- a/include/gsl/gsl_algorithm +++ b/include/gsl/gsl_algorithm @@ -25,6 +25,7 @@ #include // for is_assignable #ifdef _MSC_VER +#include // for stdext::make_checked_array_iterator #pragma warning(push) // turn off some warnings that are noisy about our Expects statements @@ -51,7 +52,11 @@ void copy(span src, span "Source range is longer than target range"); Expects(dest.size() >= src.size()); +#ifdef _MSC_VER + std::copy_n(src.data(), src.size(), stdext::make_checked_array_iterator(dest.data(), dest.size())); +#else std::copy_n(src.data(), src.size(), dest.data()); +#endif } } // namespace gsl