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
This commit is contained in:
Marshall Clow 2015-06-02 13:04:18 +00:00
parent fa97c2e8bc
commit 56523ff60e

View File

@ -1522,8 +1522,10 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
{
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 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
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>