Fix copy and move operations of Buffer

This commit is contained in:
Jean Pierre Cimalando 2021-04-25 08:11:42 +02:00
parent 954ae4c286
commit 11abec50ba

View file

@ -230,7 +230,7 @@ public:
* *
* @param other * @param other
*/ */
Buffer(const Buffer<Type>& other) Buffer(const Buffer<Type, Alignment>& other)
{ {
resize(other.size()); resize(other.size());
std::memcpy(this->data(), other.data(), other.size() * sizeof(value_type)); std::memcpy(this->data(), other.data(), other.size() * sizeof(value_type));
@ -241,7 +241,7 @@ public:
* *
* @param other * @param other
*/ */
Buffer(Buffer<Type>&& other) noexcept Buffer(Buffer<Type, Alignment>&& other) noexcept
: largerSize(other.largerSize), : largerSize(other.largerSize),
alignedSize(other.alignedSize), alignedSize(other.alignedSize),
normalData(other.normalData), normalData(other.normalData),
@ -252,7 +252,7 @@ public:
other._clear(); other._clear();
} }
Buffer<Type>& operator=(const Buffer<Type>& other) Buffer<Type, Alignment>& operator=(const Buffer<Type, Alignment>& other)
{ {
if (this != &other) { if (this != &other) {
resize(other.size()); resize(other.size());
@ -261,7 +261,7 @@ public:
return *this; return *this;
} }
Buffer<Type>& operator=(Buffer<Type>&& other) noexcept Buffer<Type, Alignment>& operator=(Buffer<Type, Alignment>&& other) noexcept
{ {
if (this != &other) { if (this != &other) {
if (largerSize > 0) if (largerSize > 0)