STL: 排列(permutation)

next_permutation

Reorders the elements in a range so that the original ordering is replaced by the lexicographically next greater permutation if it exists, where the sense of next may be specified with a binary predicate.

template<class BidirectionalIterator> 
   bool next_permutation( 
      BidirectionalIterator _First,  
      BidirectionalIterator _Last 
   ); 
template<class BidirectionalIterator, class BinaryPredicate> 
   bool next_permutation( 
      BidirectionalIterator _First,  
      BidirectionalIterator _Last, 
      BinaryPredicate _Comp 
   );

prev_permutation

Reorders the elements in a range so that the original ordering is replaced by the lexicographically previous greater permutation if it exists, where the sense of previous may be specified with a binary predicate.

template<class BidirectionalIterator>
   bool prev_permutation(
      BidirectionalIterator _First, 
      BidirectionalIterator _Last
   );
template<class BidirectionalIterator, class BinaryPredicate>
   bool prev_permutation(
      BidirectionalIterator _First, 
      BidirectionalIterator _Last,
      BinaryPredicate _Comp
   );
原文地址:https://www.cnblogs.com/freewater/p/2954160.html