0

I am new to c++, and I've confronted with an unsolvable problem. I am writing a program to work with a large size CSV file and I need to do some specific operation, including swapping(for sorting). I've used following code, but I don't know it would be better to use a temporary variable.

template<typename T>
void swape(T& Par1, T&Par2)
{
Par1 = Par1+Par2;
Par2 = Par1 - Par2;
Par1 = Par1 - Par2;
}

I think it would probably be more computationally demanding rather than using temporary variable. I would appreciate, if any one could answer me, which one is better to use.

Sincerely.

0 Answers0