summaryrefslogtreecommitdiffstats
path: root/src/core/String.cpp
diff options
context:
space:
mode:
authorMarc <marc.gilleron@gmail.com>2021-06-01 23:35:46 +0100
committerGitHub <noreply@github.com>2021-06-01 23:35:46 +0100
commitfda7ddd158b2d2ef6d7af7d509694415ec81d615 (patch)
tree4cb346627ce8f6114827fbda244843520ada6d2a /src/core/String.cpp
parent59959b1a5bc8c81800115daf7ec29e01324f7dfd (diff)
parent7a1890345b2658b422823bce889f88cc7dbb76d5 (diff)
downloadredot-cpp-fda7ddd158b2d2ef6d7af7d509694415ec81d615.tar.gz
Merge pull request #567 from DhruvMaroo/string
added String's move constructor and move assignment operator
Diffstat (limited to 'src/core/String.cpp')
-rw-r--r--src/core/String.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/String.cpp b/src/core/String.cpp
index c1efee5..7564572 100644
--- a/src/core/String.cpp
+++ b/src/core/String.cpp
@@ -73,6 +73,10 @@ String::String(const String &other) {
godot::api->godot_string_new_copy(&_godot_string, &other._godot_string);
}
+String::String(String &&other) {
+ godot::api->godot_string_new_copy(&_godot_string, &other._godot_string);
+}
+
String::~String() {
godot::api->godot_string_destroy(&_godot_string);
}
@@ -94,6 +98,11 @@ 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);
+}
+
bool String::operator==(const String &s) const {
return godot::api->godot_string_operator_equal(&_godot_string, &s._godot_string);
}