mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
BLI: return early when copying empty array
This commit is contained in:
parent
0ffbcc4416
commit
fa50edc999
1 changed files with 3 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue