C++ : "reset" 标准::next_permutation()

C++ : "reset" std::next_permutation()

本文关键字:permutation 标准 reset C++ next      更新时间:2023-10-16

是否有办法"重置"std::next_permutation() ?假设我想把向量的排列重复几次。我唯一能找到的是通过next_permutationprev_permutation交替进行。

谢谢

"reset"将排序序列,例如使用std::sort。请注意,如果您想使用next_permutation枚举所有排列,则必须从排序序列开始

同样,一旦再次达到字典顺序最小的排列,std::next_permutation将返回false