mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Disallow vector copying, allow moves.
This commit is contained in:
parent
34aecee1f9
commit
b62dc57a92
@ -24,12 +24,32 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector( const Vector& ) = delete;
|
||||||
|
Vector( Vector&& src )
|
||||||
|
: m_ptr( src.m_ptr )
|
||||||
|
, m_size( src.m_size )
|
||||||
|
, m_capacity( src.m_capacity )
|
||||||
|
{
|
||||||
|
src.m_ptr = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
~Vector()
|
~Vector()
|
||||||
{
|
{
|
||||||
memUsage.fetch_sub( m_capacity * sizeof( T ), std::memory_order_relaxed );
|
memUsage.fetch_sub( m_capacity * sizeof( T ), std::memory_order_relaxed );
|
||||||
delete[] m_ptr;
|
delete[] m_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector& operator=( const Vector& ) = delete;
|
||||||
|
Vector& operator=( Vector&& src )
|
||||||
|
{
|
||||||
|
delete[] m_ptr;
|
||||||
|
m_ptr = src.m_ptr;
|
||||||
|
m_size = src.m_size;
|
||||||
|
m_capacity = src.m_capacity;
|
||||||
|
src.m_ptr = nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
bool empty() const { return m_size == 0; }
|
bool empty() const { return m_size == 0; }
|
||||||
size_t size() const { return m_size; }
|
size_t size() const { return m_size; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user