Disabled the move semantics from Buffer, just in case.
Disabled the move semantics test
This commit is contained in:
parent
5d8e758724
commit
056337b5f0
2 changed files with 32 additions and 30 deletions
|
|
@ -147,18 +147,19 @@ public:
|
|||
*
|
||||
* @param other
|
||||
*/
|
||||
Buffer(Buffer<Type>&& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
std::free(paddedData);
|
||||
largerSize = std::exchange(other.largerSize, 0);
|
||||
alignedSize = std::exchange(other.alignedSize, 0);
|
||||
paddedData = std::exchange(other.paddedData, nullptr);
|
||||
normalData = std::exchange(other.normalData, nullptr);
|
||||
normalEnd = std::exchange(other.normalEnd, nullptr);
|
||||
_alignedEnd = std::exchange(other._alignedEnd, nullptr);
|
||||
}
|
||||
}
|
||||
Buffer(Buffer<Type>&& other) = delete;
|
||||
// {
|
||||
// if (this != &other) {
|
||||
// counter().bufferDeleted(largerSize * sizeof(value_type));
|
||||
// std::free(paddedData);
|
||||
// largerSize = std::exchange(other.largerSize, 0);
|
||||
// alignedSize = std::exchange(other.alignedSize, 0);
|
||||
// paddedData = std::exchange(other.paddedData, nullptr);
|
||||
// normalData = std::exchange(other.normalData, nullptr);
|
||||
// normalEnd = std::exchange(other.normalEnd, nullptr);
|
||||
// _alignedEnd = std::exchange(other._alignedEnd, nullptr);
|
||||
// }
|
||||
// }
|
||||
|
||||
Buffer<Type>& operator=(const Buffer<Type>& other)
|
||||
{
|
||||
|
|
@ -169,19 +170,20 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Buffer<Type>& operator=(Buffer<Type>&& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
std::free(paddedData);
|
||||
largerSize = std::exchange(other.largerSize, 0);
|
||||
alignedSize = std::exchange(other.alignedSize, 0);
|
||||
paddedData = std::exchange(other.paddedData, nullptr);
|
||||
normalData = std::exchange(other.normalData, nullptr);
|
||||
normalEnd = std::exchange(other.normalEnd, nullptr);
|
||||
_alignedEnd = std::exchange(other._alignedEnd, nullptr);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
Buffer<Type>& operator=(Buffer<Type>&& other) = delete;
|
||||
// {
|
||||
// if (this != &other) {
|
||||
// counter().bufferDeleted(largerSize * sizeof(value_type));
|
||||
// std::free(paddedData);
|
||||
// largerSize = std::exchange(other.largerSize, 0);
|
||||
// alignedSize = std::exchange(other.alignedSize, 0);
|
||||
// paddedData = std::exchange(other.paddedData, nullptr);
|
||||
// normalData = std::exchange(other.normalData, nullptr);
|
||||
// normalEnd = std::exchange(other.normalEnd, nullptr);
|
||||
// _alignedEnd = std::exchange(other._alignedEnd, nullptr);
|
||||
// }
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
Type& operator[](int idx) { return *(normalData + idx); }
|
||||
constexpr pointer data() const noexcept { return normalData; }
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@ TEST_CASE("[Buffer] Copy and move")
|
|||
checkBoundaries(copyConstructed, baseSize);
|
||||
REQUIRE(std::all_of(copyConstructed.begin(), copyConstructed.end(), [](auto value) { return value == 1.0f; }));
|
||||
|
||||
sfz::Buffer<float> moveConstructed { std::move(buffer) };
|
||||
REQUIRE(buffer.empty());
|
||||
checkBoundaries(moveConstructed, baseSize);
|
||||
REQUIRE(std::all_of(moveConstructed.begin(), moveConstructed.end(), [](auto value) { return value == 1.0f; }));
|
||||
}
|
||||
// sfz::Buffer<float> moveConstructed { std::move(buffer) };
|
||||
// REQUIRE(buffer.empty());
|
||||
// checkBoundaries(moveConstructed, baseSize);
|
||||
// REQUIRE(std::all_of(moveConstructed.begin(), moveConstructed.end(), [](auto value) { return value == 1.0f; }));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue