Does C++ have a built in such as part of STL to swap two numerical values instead of doing:
int tmp = var1;
var1 = var2;
var2 = tmp;
Something like this:
std::swapValues(var1, var2);
Where swapValues is a template.
Use std::swap
std::swap(var1, var2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With