mirror of
https://github.com/boostorg/range.git
synced 2025-07-29 12:27:42 +02:00
Boost.RangeEx merged into Boost.Range
[SVN r60897]
This commit is contained in:
51
doc/reference/algorithm/next_permutation.qbk
Normal file
51
doc/reference/algorithm/next_permutation.qbk
Normal file
@ -0,0 +1,51 @@
|
||||
[section:next_permutation next_permutation]
|
||||
|
||||
[heading Prototype]
|
||||
|
||||
``
|
||||
template<class BidirectionalRange>
|
||||
void next_permutation(BidirectionalRange& rng);
|
||||
|
||||
template<class BidirectionalRange>
|
||||
void next_permutation(const BidirectionalRange& rng);
|
||||
|
||||
template<class BidirectionalRange, class Compare>
|
||||
void next_permutation(BidirectionalRange& rng, Compare pred);
|
||||
|
||||
template<class BidirectionalRange, class Compare>
|
||||
void next_permutation(const BidirectionalRange& rng, Compare pred);
|
||||
``
|
||||
|
||||
[heading Description]
|
||||
|
||||
`next_permutation` transforms the range of elements `rng` into the lexicographically next greater permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically smallest permutation and `false` is returned. `true` is returned when the next greater permutation is successfully generated.
|
||||
|
||||
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
|
||||
|
||||
[heading Definition]
|
||||
|
||||
Defined in the header file `boost/range/algorithm/permutation.hpp`
|
||||
|
||||
[heading Requirements]
|
||||
|
||||
[*For the non-predicate versions:]
|
||||
|
||||
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
|
||||
* `BidirectionalRange` is mutable.
|
||||
* `BidirectionalRange`'s value type is a model of the `LessThanComparableConcept`.
|
||||
* The ordering of objects of type `BidirectionalRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
|
||||
|
||||
[*For the predicate versions:]
|
||||
|
||||
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
|
||||
* `BidirectionalRange` is mutable.
|
||||
* `Compare` is a model of the `StrictWeakOrderingConcept`.
|
||||
* `BidirectionalRange`'s value type is convertible to both of `Compare`'s argument types.
|
||||
|
||||
[heading Complexity]
|
||||
|
||||
Linear. At most `distance(rng) / 2` swaps.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
Reference in New Issue
Block a user