From 257e85711687be985ce036ed2311ce6cf3fdc0b9 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 20 Jun 2020 02:58:32 -0500 Subject: [PATCH] [ox/std] Add move operator to String --- deps/ox/src/ox/std/string.cpp | 5 +++++ deps/ox/src/ox/std/string.hpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/deps/ox/src/ox/std/string.cpp b/deps/ox/src/ox/std/string.cpp index 81277671..18d1b9bb 100644 --- a/deps/ox/src/ox/std/string.cpp +++ b/deps/ox/src/ox/std/string.cpp @@ -70,6 +70,11 @@ const String &String::operator=(const String &src) noexcept { return *this = src.c_str(); } +const String &String::operator=(const String &&src) noexcept { + m_buff = ox::move(src.m_buff); + return *this; +} + const String &String::operator+=(const char *str) noexcept { std::size_t strLen = ox_strlen(str); auto currentLen = len(); diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index b0d932fa..67b468e5 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -41,6 +41,8 @@ class String { const String &operator=(const String &src) noexcept; + const String &operator=(const String &&src) noexcept; + const String &operator+=(const char *str) noexcept; const String &operator+=(char *str) noexcept;