mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
#621 on MSVC use copy_n with stdext::make_checked_array_iterator
This commit is contained in:
parent
c87c123d1b
commit
9d7a4839b9
@ -25,6 +25,7 @@
|
|||||||
#include <type_traits> // for is_assignable
|
#include <type_traits> // for is_assignable
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
#include <iterator> // for stdext::make_checked_array_iterator
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
||||||
// turn off some warnings that are noisy about our Expects statements
|
// turn off some warnings that are noisy about our Expects statements
|
||||||
@ -51,7 +52,11 @@ void copy(span<SrcElementType, SrcExtent> src, span<DestElementType, DestExtent>
|
|||||||
"Source range is longer than target range");
|
"Source range is longer than target range");
|
||||||
|
|
||||||
Expects(dest.size() >= src.size());
|
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());
|
std::copy_n(src.data(), src.size(), dest.data());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace gsl
|
} // namespace gsl
|
||||||
|
Loading…
Reference in New Issue
Block a user