From a1488a74a15e4c1a6ea55e26cbc587e2b5f60a4b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 8 Nov 2019 22:50:22 +0100 Subject: [PATCH] Perform Vector's swap() as a bitwise move. --- server/TracyVector.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/TracyVector.hpp b/server/TracyVector.hpp index 4ba9be1f..0502066f 100644 --- a/server/TracyVector.hpp +++ b/server/TracyVector.hpp @@ -71,9 +71,10 @@ public: tracy_force_inline void swap( Vector& other ) { - std::swap( m_ptr, other.m_ptr ); - std::swap( m_size, other.m_size ); - std::swap( m_capacity, other.m_capacity ); + uint8_t tmp[sizeof( Vector )]; + memcpy( tmp, &other, sizeof( Vector ) ); + memcpy( &other, this, sizeof( Vector ) ); + memcpy( this, tmp, sizeof( Vector ) ); } tracy_force_inline bool empty() const { return m_size == 0; }