BLI: return early when copying empty array

This commit is contained in:
Jacques Lucke 2021-04-01 12:25:30 +02:00
parent 0ffbcc4416
commit fa50edc999

View file

@ -133,6 +133,9 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
*/
template<typename T> MutableSpan<T> construct_array_copy(Span<T> src)
{
if (src.is_empty()) {
return {};
}
MutableSpan<T> dst = this->allocate_array<T>(src.size());
uninitialized_copy_n(src.data(), src.size(), dst.data());
return dst;