This is my swap function:
template <typename t>
void swap (t& x, t& y)
{
t temp = x;
x = y;
y = temp;
return;
}
And this is my function (on a side note v stores strings) call to swap values but whenever I try to call using values in a vector I get an error. I'm not sure what I'm doing wrong.
swap(v[position], v[nextposition]); //creates errors
using namespace std
in your code? Because you could have a name conflict. – Rothsteinreturn;
statement at the end of your function – Cyrstalcyrusstd::swap
? – Electrodynamometer