atArray: copy data only if not null (#123)
This commit is contained in:
parent
e56523456c
commit
3267288d55
@ -27,6 +27,12 @@ namespace rage
|
|||||||
m_count = right.m_count;
|
m_count = right.m_count;
|
||||||
m_size = right.m_size;
|
m_size = right.m_size;
|
||||||
|
|
||||||
|
if (right.m_data == nullptr)
|
||||||
|
{
|
||||||
|
m_data = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_data = (T*)tlsContext::get()->m_allocator->Allocate(m_size * sizeof(T), 16, 0);
|
m_data = (T*)tlsContext::get()->m_allocator->Allocate(m_size * sizeof(T), 16, 0);
|
||||||
std::uninitialized_copy(right.m_data, right.m_data + right.m_count, m_data);
|
std::uninitialized_copy(right.m_data, right.m_data + right.m_count, m_data);
|
||||||
}
|
}
|
||||||
@ -153,12 +159,12 @@ namespace rage
|
|||||||
m_data = newOffset;
|
m_data = newOffset;
|
||||||
m_count = newSize;
|
m_count = newSize;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void append(T value)
|
void append(T value)
|
||||||
{
|
{
|
||||||
set(m_count, value);
|
set(m_count, value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
T* begin() const
|
T* begin() const
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user