Merge pull request #857 from jpcima/buffer-fix

Fix copy and move operations of Buffer
This commit is contained in:
JP Cimalando 2021-04-25 09:13:41 +02:00 committed by GitHub
commit 6e901c2eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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)