From d85499885649a8a37f77ccfe2c1f310562c8f9c0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 13 Feb 2019 02:20:31 +0100 Subject: [PATCH] Support non-trivially-copyable items in Vector. --- server/TracyVector.hpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/server/TracyVector.hpp b/server/TracyVector.hpp index ad47c82f..68777c41 100644 --- a/server/TracyVector.hpp +++ b/server/TracyVector.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "../common/TracyForceInline.hpp" #include "TracyMemory.hpp" @@ -280,7 +281,17 @@ private: T* ptr = new T[CapacityNoNullptrCheck()]; if( m_size != 0 ) { - memcpy( ptr, m_ptr, m_size * sizeof( T ) ); + if( std::is_trivially_copyable() ) + { + memcpy( ptr, m_ptr, m_size * sizeof( T ) ); + } + else + { + for( uint32_t i=0; i