summaryrefslogtreecommitdiffstats
path: root/src/core/String.cpp
diff options
context:
space:
mode:
authorDhruvMaroo <dhruvmaru007@gmail.com>2021-05-30 12:33:40 +0530
committerDhruvMaroo <dhruvmaru007@gmail.com>2021-05-30 12:33:40 +0530
commitbdc5674ace9fc06a58497d0fc25cdff07cddf72b (patch)
tree2e91de8252ccc6c2abfbcfbb2554a998c879e892 /src/core/String.cpp
parent689b5fb98b4e3e618ed3571986d9b860f00b194e (diff)
downloadredot-cpp-bdc5674ace9fc06a58497d0fc25cdff07cddf72b.tar.gz
added move assignment operator
Diffstat (limited to 'src/core/String.cpp')
-rw-r--r--src/core/String.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/String.cpp b/src/core/String.cpp
index 19e44f9..3414adf 100644
--- a/src/core/String.cpp
+++ b/src/core/String.cpp
@@ -99,6 +99,12 @@ void String::operator=(const String &s) {
godot::api->godot_string_new_copy(&_godot_string, &s._godot_string);
}
+void String::operator=(String&& s) {
+ godot::api->godot_string_destroy(&_godot_string);
+ godot::api->godot_string_new_copy(&_godot_string, &s._godot_string);
+ godot::api->godot_string_destroy(&s._godot_string);
+}
+
bool String::operator==(const String &s) const {
return godot::api->godot_string_operator_equal(&_godot_string, &s._godot_string);
}