Computer Science 1037A/B Lecture 28: Move Constructors
Document Summary
Move constructors are useful when we want to copy" temporary objects and variables. Think of money for example when your landlord cashes your cheque they are moving money from your account to their account. If we had to use copy semantics only then that act would be. Place copy of rent amount in landlords bank. Destroy rent amount in our bank with move semantics. Move rent amount from our bank to landlords bank lvalues and rvalues. Historically lvalues meant can appear on the left of an expression and rvalues meant can appear on the right of an expression . Consider the following: int x = 9; int y = 10; int z = x+y; In this case we can see that x, y, and z are lvalues they appear on the left and can reappear on the left such as x=10; 9,10,and x+y" are rvalues they appear on the right and cannot reappear.