From d21565d00f222a22d60189c0288535bb30915ddf Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:31:31 +0200 Subject: [PATCH] Recast: use rdSwap for rdVectorBase::swap Headers were reorganized a while back, clean this code up. --- .../recast/Shared/Include/SharedAlloc.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/thirdparty/recast/Shared/Include/SharedAlloc.h b/src/thirdparty/recast/Shared/Include/SharedAlloc.h index 2cc3ab3f..fb474494 100644 --- a/src/thirdparty/recast/Shared/Include/SharedAlloc.h +++ b/src/thirdparty/recast/Shared/Include/SharedAlloc.h @@ -21,6 +21,7 @@ #include "SharedDefs.h" #include "SharedAssert.h" +#include "SharedCommon.h" /// Provides hint values to the memory allocator on how long the /// memory is expected to be used. @@ -243,18 +244,9 @@ void rdVectorBase::resize_impl(rdSizeType size, const T* value) { } template void rdVectorBase::swap(rdVectorBase& other) { - // TODO: Reorganize headers so we can use rcSwap here. - rdSizeType tmp_cap = other.m_cap; - rdSizeType tmp_size = other.m_size; - T* tmp_data = other.m_data; - - other.m_cap = m_cap; - other.m_size = m_size; - other.m_data = m_data; - - m_cap = tmp_cap; - m_size = tmp_size; - m_data = tmp_data; + rdSwap(m_cap, other.m_cap); + rdSwap(m_size, other.m_size); + rdSwap(m_data, other.m_data); } // static template