Question

I posted a question earlier . The code could be checked from the response.

My question is the author of the post posted this in the move constructor

swap(*this,that); 

and this in the copy assignment operator

swap(that);

Now I am familiar with the concept of friend functions and have done more reading on it however I am still baffled as to why the second statement only has one parameter whereas the swap method requires two parameters. I would appreciate it if some one can clarify the second statement and why its just passing one parameter ?

Was it helpful?

Solution

As the other of said answer, that was a typo. Both should have been

swap(*this,that); 

Jonathan Wakely pointed out my error and I have corrected it.

There was no magic involved that you didn't know, hooray!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top