Implement custom vector swap.

This commit is contained in:
Bartosz Taudul 2019-03-26 23:02:32 +01:00
parent a632d9e2a3
commit 6c5efbfdce

View File

@ -1,6 +1,7 @@
#ifndef __TRACYVECTOR_HPP__ #ifndef __TRACYVECTOR_HPP__
#define __TRACYVECTOR_HPP__ #define __TRACYVECTOR_HPP__
#include <algorithm>
#include <assert.h> #include <assert.h>
#include <limits> #include <limits>
#include <stdint.h> #include <stdint.h>
@ -63,6 +64,13 @@ public:
return *this; return *this;
} }
void swap( Vector& other )
{
std::swap( m_ptr, other.m_ptr );
std::swap( m_size, other.m_size );
std::swap( m_capacity, other.m_capacity );
}
tracy_force_inline bool empty() const { return m_size == 0; } tracy_force_inline bool empty() const { return m_size == 0; }
tracy_force_inline size_t size() const { return m_size; } tracy_force_inline size_t size() const { return m_size; }