Difference between Copy assignment operator vs Move assignment operator

 

Copy Assignment OperatorsMove Assignment Operators
Copy assignment operator takes lvalue reference as an argument.Move assignment operator takes rvalue reference as argument.
Copy assignment operator create a new object from passed object by copying each and every item into a new memory location.Move assignment operator create a new object by using as much memory from passed object.
Since, copy assignment operator use a lot of new memory allocation(for new object). Hence, copy constructors gives bad performance compared to move constructorsSince, move assignment operator use most of memory blocks from passed object. Hence, move constructors gave better performance compared to copy constructors.
Since, copy assignment operator doesn’t make any change to passed object. Hence, passed object can be used after copy operations also.Since, move assignment operator utilizes memory blocks from passed object. Hence, passed object can’t be used after move operations.

For more information related to move assignment operators click here.

Difference between Copy assignment operator vs Move assignment operator Read More

Difference between Copy constructor vs Move constructor

 

Copy ConstructorsMove Constructors
Copy constructors takes lvalue reference as an argument.Move constructors takes rvalue reference as argument.
Copy constructors create a new object from passed object by copying each and every item into a new memory location.Move constructors create a new object by using as much memory from passed object.
Since, copy constructors use a lot of new memory allocation(for new object). Hence, copy constructors gives bad performance compared to move constructorsSince, move constructors use most of memory blocks from passed object. Hence, move constructors gave better performance compared to copy constructors.
Since, copy constructors doesn’t make any change to passed object. Hence, passed object can be used after copy operations also.Since, move constructors utilizes memory blocks from passed object. Hence, passed object can’t be used after move operations.

For more information related to Move constructors click here

Difference between Copy constructor vs Move constructor Read More