added mover constructor

pull/567/head
DhruvMaroo 2021-05-30 12:30:11 +05:30
parent dfee6f0ca4
commit 689b5fb98b
2 changed files with 6 additions and 0 deletions

View File

@ -40,6 +40,7 @@ public:
String(const wchar_t *contents); String(const wchar_t *contents);
String(const wchar_t c); String(const wchar_t c);
String(const String &other); String(const String &other);
String(String&& other);
~String(); ~String();

View File

@ -73,6 +73,11 @@ String::String(const String &other) {
godot::api->godot_string_new_copy(&_godot_string, &other._godot_string); 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);
godot::api->godot_string_destroy(&_godot_string);
}
String::~String() { String::~String() {
godot::api->godot_string_destroy(&_godot_string); godot::api->godot_string_destroy(&_godot_string);
} }