any/meta_any: safe but unspecified state after self move - close #1206
Related Work Items: #1
This commit is contained in:
@@ -249,12 +249,14 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
*
|
||||
* @warning
|
||||
* Self-moving puts objects in a safe but unspecified state.
|
||||
*
|
||||
* @param other The instance to move from.
|
||||
* @return This any object.
|
||||
*/
|
||||
basic_any &operator=(basic_any &&other) noexcept {
|
||||
ENTT_ASSERT(this != &other, "Self move assignment");
|
||||
|
||||
reset();
|
||||
|
||||
if(other.mode == any_policy::embedded) {
|
||||
|
||||
@@ -357,13 +357,15 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Move assignment operator.
|
||||
*
|
||||
* @warning
|
||||
* Self-moving puts objects in a safe but unspecified state.
|
||||
*
|
||||
* @param other The instance to move from.
|
||||
* @return This meta any object.
|
||||
*/
|
||||
meta_any &operator=(meta_any &&other) noexcept {
|
||||
ENTT_ASSERT(this != &other, "Self move assignment");
|
||||
|
||||
release();
|
||||
reset();
|
||||
storage = std::move(other.storage);
|
||||
ctx = other.ctx;
|
||||
node = std::exchange(other.node, internal::meta_type_node{});
|
||||
|
||||
Reference in New Issue
Block a user