diff options
author | Marc <marc.gilleron@gmail.com> | 2021-06-01 23:35:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-01 23:35:46 +0100 |
commit | fda7ddd158b2d2ef6d7af7d509694415ec81d615 (patch) | |
tree | 4cb346627ce8f6114827fbda244843520ada6d2a /src/core/String.cpp | |
parent | 59959b1a5bc8c81800115daf7ec29e01324f7dfd (diff) | |
parent | 7a1890345b2658b422823bce889f88cc7dbb76d5 (diff) | |
download | redot-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.cpp | 9 |
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); } |