Parallel code for next_permutation()
问题 I am wondering if I can parallelize this code using OpenMP. Will OpenMP make the code run faster? Is there a better way to achieve this? vector<int> t; // already initialized do{ // Something with current permutation } while(next_permutation(t.begin(), t.end())); I know I can easily parallelize a for instruction, but here I have a while (condition = true) . 回答1: next_permutation produces permutations in lexicographical order, which means that the prefixes to the permutations produced are also