getnext function

Get the next permutation(s)/combination(s) for a iterator