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:
parent
fa97c2e8bc
commit
56523ff60e
@ -1522,9 +1522,11 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
|
|||||||
{
|
{
|
||||||
ptrdiff_t _Np = __end1 - __begin1;
|
ptrdiff_t _Np = __end1 - __begin1;
|
||||||
if (_Np > 0)
|
if (_Np > 0)
|
||||||
|
{
|
||||||
_VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
|
_VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
|
||||||
__begin2 += _Np;
|
__begin2 += _Np;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <class _Iter, class _Ptr>
|
template <class _Iter, class _Ptr>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
@ -1551,9 +1553,11 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
|
|||||||
typedef typename remove_const<_Tp>::type _Vp;
|
typedef typename remove_const<_Tp>::type _Vp;
|
||||||
ptrdiff_t _Np = __end1 - __begin1;
|
ptrdiff_t _Np = __end1 - __begin1;
|
||||||
if (_Np > 0)
|
if (_Np > 0)
|
||||||
|
{
|
||||||
_VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp));
|
_VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp));
|
||||||
__begin2 += _Np;
|
__begin2 += _Np;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <class _Ptr>
|
template <class _Ptr>
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user