mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Use memcpy and memset instead of per-element copy and zero.
This commit is contained in:
parent
d854998856
commit
40d0c72982
@ -30,13 +30,9 @@ public:
|
||||
|
||||
Vector( const Vector& ) = delete;
|
||||
Vector( Vector&& src ) noexcept
|
||||
: m_ptr( src.m_ptr )
|
||||
, m_size( src.m_size )
|
||||
, m_capacity( src.m_capacity )
|
||||
{
|
||||
src.m_ptr = nullptr;
|
||||
src.m_size = 0;
|
||||
src.m_capacity = 0;
|
||||
memcpy( this, &src, sizeof( Vector<T> ) );
|
||||
memset( &src, 0, sizeof( Vector<T> ) );
|
||||
}
|
||||
|
||||
Vector( const T& value )
|
||||
@ -65,12 +61,8 @@ public:
|
||||
Vector& operator=( Vector&& src ) noexcept
|
||||
{
|
||||
delete[] m_ptr;
|
||||
m_ptr = src.m_ptr;
|
||||
m_size = src.m_size;
|
||||
m_capacity = src.m_capacity;
|
||||
src.m_ptr = nullptr;
|
||||
src.m_size = 0;
|
||||
src.m_capacity = 0;
|
||||
memcpy( this, &src, sizeof( Vector<T> ) );
|
||||
memset( &src, 0, sizeof( Vector<T> ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user