2

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 ?

Community
  • 1
  • 1
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158

1 Answers1

1

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!

Mooing Duck
  • 64,318
  • 19
  • 100
  • 158