Skip to content

Commit

Permalink
CUtlMemory: update the copy from method
Browse files Browse the repository at this point in the history
  • Loading branch information
Wend4r committed Nov 25, 2024
1 parent 5a926ff commit 2a8257f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions public/tier1/utlmemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,12 @@ CUtlMemory<T,I>& CUtlMemory<T,I>::operator=( CUtlMemory& moveFrom )
template< class T, class I >
void CUtlMemory<T,I>::CopyFrom( const CUtlMemory& from )
{
Init( from.m_nAllocationCount, from.m_nGrowSize );
memcpy( m_pMemory, from.m_pMemory, from.m_nAllocationCount * sizeof(T) );
Init( from.m_nGrowSize, from.m_nAllocationCount );

if( m_pMemory )
{
memcpy( m_pMemory, from.m_pMemory, from.m_nAllocationCount * sizeof(T) );
}
}

template< class T, class I >
Expand Down

0 comments on commit 2a8257f

Please sign in to comment.