stl:algorithm:next_permutation

C++ Reference

next_permutation

Syntax:

    #include <algorithm>
    bool next_permutation( iterator start, iterator end );
    bool next_permutation( iterator start, iterator end, StrictWeakOrdering cmp );

The next_permutation() function attempts to transform the given range of elements [start,end) into the next lexicographically greater 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 in lieu of the < operator when comparing elements.

Related Topics: prev_permutation, random_sample, random_sample_n, random_shuffle