SomeType temp = arg1;
This would do a deep copy of the object pointed to by the ref arg1. What is intended is probably
SomeType& temp = arg1;
You can't do a generic swap without 3 deep copies.
If you change temp to be a reference, then once you do "arg1 = arg2", you just lost any way to get arg1's value back.
SomeType temp = arg1;
This would do a deep copy of the object pointed to by the ref arg1. What is intended is probably
SomeType& temp = arg1;