diff --git a/public/tier1/utlleanvector.h b/public/tier1/utlleanvector.h index 8d90275e..f7dc7141 100644 --- a/public/tier1/utlleanvector.h +++ b/public/tier1/utlleanvector.h @@ -45,6 +45,8 @@ public: T* Base(); const T* Base() const; + void Swap( CUtlLeanVectorBase &mem ); + // Makes sure we have enough memory allocated to store a requested # of elements void EnsureCapacity( int num, bool force = false ); @@ -113,6 +115,17 @@ inline const T* CUtlLeanVectorBase::Base() const return NumAllocated() ? m_pElements : nullptr; } +//----------------------------------------------------------------------------- +// Fast swap +//----------------------------------------------------------------------------- +template< class T, class I, class A > +void CUtlLeanVectorBase::Swap( CUtlLeanVectorBase &vec ) +{ + V_swap( m_nCount, vec.m_nCount ); + V_swap( m_nAllocated, vec.m_nAllocated ); + V_swap( m_pElements, vec.m_pElements ); +} + //----------------------------------------------------------------------------- // Attaches the buffer to external memory.... //-----------------------------------------------------------------------------