From af76b9a0ae58dc8c87548053a5bc310ad6be25ce Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 1 Nov 2024 21:33:27 +0100 Subject: more small tweaks --- backend/String.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'backend/String.cpp') diff --git a/backend/String.cpp b/backend/String.cpp index 381277e..c856d86 100644 --- a/backend/String.cpp +++ b/backend/String.cpp @@ -11,13 +11,24 @@ String::String() { } +String::String(const String & other) { + this->set(other.data(), other.size()); +} String & String::operator = (const String & other) { + if (this == &other) return *this; this->set(other.data(), other.size()); return *this; } -String::String(const String & other) { - this->set(other.data(), other.size()); +String::String(String && other) { + this->_data = other._data; + this->_data_len = other._data_len; +} +String & String::operator = (String && other) { + if (this == &other) return *this; + this->_data = other._data; + this->_data_len = other._data_len; + return *this; } String::String(const char * c_str) { -- cgit v1.2.3