4
有沒有辦法「重置」std::next_permutation()
?假設我想多次查看矢量的排列。我唯一能找到的就是經過next_permutation
和prev_permutation
。C++:「reset」std :: next_permutation()
謝謝
有沒有辦法「重置」std::next_permutation()
?假設我想多次查看矢量的排列。我唯一能找到的就是經過next_permutation
和prev_permutation
。C++:「reset」std :: next_permutation()
謝謝
「重置」將排序序列,例如,使用std::sort
。請注意,如果要使用next_permutation
枚舉所有排列,則具有以排序的序列開始。
另外,std::next_permutation
將返回false
一旦按字典順序最小的排列再次達成。
這正是我所需要的。謝謝 –