+1

Should we check for self assignment when overloading shorthand assignment operators?

3 Answers

New Answer

+3

Could you demonstrate with an example code?

+2

Sonic https://code.sololearn.com/ctSf67r7HxLo/?ref=app

+1

𝕄𝕠𝕤𝕖𝕤 𝕆𝕕𝕙𝕚𝕒𝕞𝕓𝕠 No clear mandate on this. Experts says self assignment/move is rare so it's not worth checking. But take a look at this thread https://stackoverflow.com/q/9322174/7986108