"resetting" would be sorting the sequence, e.g. using std::sort
. Note that you have to start off with a sorted sequence if you want to enumerate all permutations using next_permutation
.
Also, std::next_permutation
will return false
once the lexicographically smallest permutation is reached again.