In the case where we are copying/moving zero elements, do less work
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238828 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/memory b/include/memory
index 6f3fdd5..4e3a6f8 100644
--- a/include/memory
+++ b/include/memory
@@ -1522,8 +1522,10 @@
{
ptrdiff_t _Np = __end1 - __begin1;
if (_Np > 0)
+ {
_VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
- __begin2 += _Np;
+ __begin2 += _Np;
+ }
}
template <class _Iter, class _Ptr>
@@ -1551,8 +1553,10 @@
typedef typename remove_const<_Tp>::type _Vp;
ptrdiff_t _Np = __end1 - __begin1;
if (_Np > 0)
+ {
_VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp));
- __begin2 += _Np;
+ __begin2 += _Np;
+ }
}
template <class _Ptr>