Erase the source SeArray immediately in move ctor.
This commit is contained in:
1 parent
89bf5914d5
commit
fc67ba6b46
2 files changed
+10
-1
No files matched your search
@@ -4,6 +4,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace Chaos::Service
|
namespace Chaos::Service
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SeArray(const SeArray & other) = delete;
|
SeArray(const SeArray & other) = delete;
|
||||||
SeArray(SeArray && other) = default;
|
|
||||||
|
SeArray(SeArray && other)
|
||||||
|
{
|
||||||
|
Storage_ = std::move(other.Storage_);
|
||||||
|
other.EraseImpl();
|
||||||
|
}
|
||||||
|
|
||||||
SeArray & operator=(const SeArray & other) = default;
|
SeArray & operator=(const SeArray & other) = default;
|
||||||
SeArray & operator=(SeArray && other) = default;
|
SeArray & operator=(SeArray && other) = default;
|
||||||
|
|||||||
@@ -337,5 +337,8 @@ TEST(SeArrayTests, MoveConstructTest)
|
|||||||
SeArray<int32_t, 2> arr2(std::move(arr1));
|
SeArray<int32_t, 2> arr2(std::move(arr1));
|
||||||
ASSERT_EQ(0x11, arr2[0]);
|
ASSERT_EQ(0x11, arr2[0]);
|
||||||
ASSERT_EQ(0x22, arr2[1]);
|
ASSERT_EQ(0x22, arr2[1]);
|
||||||
|
|
||||||
|
ASSERT_EQ(0, arr1[0]);
|
||||||
|
ASSERT_EQ(0, arr1[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user