문제

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 ?

도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top