mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +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( const Vector& ) = delete;
|
||||||
Vector( Vector&& src ) noexcept
|
Vector( Vector&& src ) noexcept
|
||||||
: m_ptr( src.m_ptr )
|
|
||||||
, m_size( src.m_size )
|
|
||||||
, m_capacity( src.m_capacity )
|
|
||||||
{
|
{
|
||||||
src.m_ptr = nullptr;
|
memcpy( this, &src, sizeof( Vector<T> ) );
|
||||||
src.m_size = 0;
|
memset( &src, 0, sizeof( Vector<T> ) );
|
||||||
src.m_capacity = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector( const T& value )
|
Vector( const T& value )
|
||||||
@ -65,12 +61,8 @@ public:
|
|||||||
Vector& operator=( Vector&& src ) noexcept
|
Vector& operator=( Vector&& src ) noexcept
|
||||||
{
|
{
|
||||||
delete[] m_ptr;
|
delete[] m_ptr;
|
||||||
m_ptr = src.m_ptr;
|
memcpy( this, &src, sizeof( Vector<T> ) );
|
||||||
m_size = src.m_size;
|
memset( &src, 0, sizeof( Vector<T> ) );
|
||||||
m_capacity = src.m_capacity;
|
|
||||||
src.m_ptr = nullptr;
|
|
||||||
src.m_size = 0;
|
|
||||||
src.m_capacity = 0;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user