prev_permutation

Syntax:

    #include <algorithm>
    bool prev_permutation( bidirectional_iterator start, bidirectional_iterator end );
    bool prev_permutation( bidirectional_iterator start, bidirectional_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: next_permutation, random_sample, random_sample_n, random_shuffle