add move constructor, assignment to String class
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user