prev_permutation

C++ Reference

prev_permutation
Syntax:
  #include <algorithm>
  bool prev_permutation( iterator start, iterator end );
  bool prev_permutation( iterator start, iterator end, StrictWeakOrdering cmp );

The prev_permutation() function attempts to transform the given range of elements [start,end) into the next lexicographically smaller permutation of elements. If it succeeds, it returns true, otherwise, it returns false.

If a strict weak ordering function object cmp is provided, it is used instead of the < operator when comparing elements.

Related topics: