do
{
for(vector<int>::iterator it = vec.begin(); it != vec.end(); it++)
cout << *it << " ";
cout << endl;
} while(next_permutation(vec));
even when I comment out the returnfalse; line, which makes me think the compiler is adding something.
The idea is that the function should return false if the given string/vector is already the last permutation, but true if a new one is generated.
What I have seems fine to me, but the fact that it still works with a crucial line removed worries me. Is it just the compiler adding returnfalse at the end of the function for me that is creating this result?
Doesn't the compiler warn that not all control statements return a value ? Just set a breakpoint on returnfalse; to test that your code reaches that line when it's supposed to.