summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tag_compound.cpp5
-rw-r--r--src/tag_string.cpp5
-rw-r--r--src/value.cpp4
3 files changed, 13 insertions, 1 deletions
diff --git a/src/tag_compound.cpp b/src/tag_compound.cpp
index 53fd9df8ac..1d4fd6d720 100644
--- a/src/tag_compound.cpp
+++ b/src/tag_compound.cpp
@@ -94,6 +94,11 @@ bool tag_compound::equals(const tag& rhs) const
return *this == static_cast<const tag_compound&>(rhs);
}
+tag_compound& tag_compound::assign(tag&& rhs)
+{
+ return *this = dynamic_cast<tag_compound&&>(rhs);
+}
+
bool operator==(const tag_compound& lhs, const tag_compound& rhs)
{
return lhs.tags == rhs.tags;
diff --git a/src/tag_string.cpp b/src/tag_string.cpp
index b3ef075cd3..aade42768b 100644
--- a/src/tag_string.cpp
+++ b/src/tag_string.cpp
@@ -82,6 +82,11 @@ bool tag_string::equals(const tag& rhs) const
return *this == static_cast<const tag_string&>(rhs);
}
+tag_string& tag_string::assign(tag&& rhs)
+{
+ return *this = dynamic_cast<tag_string&&>(rhs);
+}
+
bool operator==(const tag_string& lhs, const tag_string& rhs)
{
return lhs.get() == rhs.get();
diff --git a/src/value.cpp b/src/value.cpp
index 339c737505..a5f8e3c894 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -19,6 +19,7 @@
*/
#include "value.h"
#include "libnbt.h"
+#include <typeinfo>
namespace nbt
{
@@ -35,7 +36,8 @@ value& value::operator=(std::unique_ptr<tag>&& t)
value& value::operator=(tag&& t)
{
- return *this = std::move(t).move_clone();
+ tag_->assign(std::move(t));
+ return *this;
}
tag_type value::get_type() const