mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Support non-trivially-copyable items in Vector.
This commit is contained in:
parent
08642d034b
commit
d854998856
@ -4,6 +4,7 @@
|
||||
#include <assert.h>
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
#include <type_traits>
|
||||
|
||||
#include "../common/TracyForceInline.hpp"
|
||||
#include "TracyMemory.hpp"
|
||||
@ -279,8 +280,18 @@ private:
|
||||
{
|
||||
T* ptr = new T[CapacityNoNullptrCheck()];
|
||||
if( m_size != 0 )
|
||||
{
|
||||
if( std::is_trivially_copyable<T>() )
|
||||
{
|
||||
memcpy( ptr, m_ptr, m_size * sizeof( T ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( uint32_t i=0; i<m_size; i++ )
|
||||
{
|
||||
ptr[i] = std::move( m_ptr[i] );
|
||||
}
|
||||
}
|
||||
delete[] m_ptr;
|
||||
}
|
||||
m_ptr = ptr;
|
||||
|
Loading…
Reference in New Issue
Block a user