mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 12:06:07 +08:00
Add CUtlLeanVector::Swap method
This commit is contained in:
@ -45,6 +45,8 @@ public:
|
||||
T* Base();
|
||||
const T* Base() const;
|
||||
|
||||
void Swap( CUtlLeanVectorBase<T, I, A> &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<T, I, A>::Base() const
|
||||
return NumAllocated() ? m_pElements : nullptr;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Fast swap
|
||||
//-----------------------------------------------------------------------------
|
||||
template< class T, class I, class A >
|
||||
void CUtlLeanVectorBase<T, I, A>::Swap( CUtlLeanVectorBase<T, I, A> &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....
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user