I have a vector
of int's... I just want to swap two values.
std::vector<int> vec;
vec.push_back(0);
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
vec.push_back(4);
vec.push_back(5);
vec.push_back(6);
vec.push_back(7);
vec.push_back(8);
std::swap(vec.begin(), vec.end());
Before the swap being called I have my vec as:
[0,1,2,3,4,5,6,7,8]
After the std::swap(...)
I was hoping to have the vec as:
[8,1,2,3,4,5,6,7,0]
But it remains as the initial state. What is the problem here?