From 689b5fb98b4e3e618ed3571986d9b860f00b194e Mon Sep 17 00:00:00 2001 From: DhruvMaroo Date: Sun, 30 May 2021 12:30:11 +0530 Subject: [PATCH] added mover constructor --- include/core/String.hpp | 1 + src/core/String.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/core/String.hpp b/include/core/String.hpp index 7c11ac78..62b58e4d 100644 --- a/include/core/String.hpp +++ b/include/core/String.hpp @@ -40,6 +40,7 @@ public: String(const wchar_t *contents); String(const wchar_t c); String(const String &other); + String(String&& other); ~String(); diff --git a/src/core/String.cpp b/src/core/String.cpp index c1efee54..19e44f90 100644 --- a/src/core/String.cpp +++ b/src/core/String.cpp @@ -73,6 +73,11 @@ 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); + godot::api->godot_string_destroy(&_godot_string); +} + String::~String() { godot::api->godot_string_destroy(&_godot_string); }