From 41c3dfc96e18cb5da665143e2425635213cc00eb Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 18 Aug 2021 01:24:53 +0300 Subject: [PATCH] add move constructor, assignment to String class --- libs/string/string.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/string/string.h b/libs/string/string.h index 75bbb7e8..912af644 100644 --- a/libs/string/string.h +++ b/libs/string/string.h @@ -368,12 +368,19 @@ public: String( const String& other ) : Buffer( other ){ } + String( String&& other ) noexcept { + swap( other ); + } String& operator=( const String& other ){ String temp( other ); temp.swap( *this ); return *this; } + String& operator=( String&& other ) noexcept { + swap( other ); + return *this; + } String& operator=( const char* string ){ String temp( string ); temp.swap( *this );