mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 03:56:10 +08:00
Add CUtlLeanVector::Swap method
This commit is contained in:
@ -45,6 +45,8 @@ public:
|
|||||||
T* Base();
|
T* Base();
|
||||||
const T* Base() const;
|
const T* Base() const;
|
||||||
|
|
||||||
|
void Swap( CUtlLeanVectorBase<T, I, A> &mem );
|
||||||
|
|
||||||
// Makes sure we have enough memory allocated to store a requested # of elements
|
// Makes sure we have enough memory allocated to store a requested # of elements
|
||||||
void EnsureCapacity( int num, bool force = false );
|
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;
|
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....
|
// Attaches the buffer to external memory....
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user