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