Some things you need to know:
- This code is not efficient, if you want a more efficient solution, then turn to the STL algorithm next_permutation.
- When there are double characters (i.e. characters which occur multiple times) in the string to permute then some permutations will be generated multiple times.
- As this function will generate all permutations and since the factorial of the string length grows very quickly, you should make sure that you don't pass a string containing too much characters, you know: it could take years to complete, and this is probably not what you want.