Illustrating the generic swap algorithm: swap two integers
#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int high = 250, low = 0;
swap(high, low);
cout << high << " ";
cout << low;
return 0;
}
/*
0 250
*/
Related examples in the same category