Suppose I need to perform some standalone task on every permutation of a sequence. std::next_permutation
provides an easy way to iterate over all the permutations in lexicographic order, but suppose I'd like to take advantage of multiple cores by having thread #1 handle permutations 0 to 999,999, thread #2 handle 1,000,000 to 1,999,999, etc.
Is there a way to get the +n th permutation of a sequence aside from calling next_permutation
n times?