vector<int> a(4);
// Initialize 1, 2, 3, 4
generate(a.begin(), a.end(), SequenceGenerator(1));
while (next_permutation(a.begin(), a.end()))
{
cout << "Output permutation ";
vector<int>::iterator p = a.begin();
while (p != a.end())
{
cout << *p << " ";
++p;
}
cout << "\n";
}