]> git.lizzy.rs Git - rust.git/commit
Add next_permutation and prev_permutation onto MutableOrdVector<T>.
authorThomas Backman <serenity@exscape.org>
Tue, 3 Jun 2014 14:11:47 +0000 (16:11 +0200)
committerThomas Backman <serenity@exscape.org>
Tue, 3 Jun 2014 14:11:47 +0000 (16:11 +0200)
commit3b5d6fd25486b29a70adfda6cb917ced614bc6d2
treea0ddcc7a971f62d52d07bad9170eec327714fcb5
parent918dbfea60e84868537a1951ad38a782502d39c2
Add next_permutation and prev_permutation onto MutableOrdVector<T>.

Unlike ImmutableClonableVector::permutations() which returns an iterator,
cloning the entire array each iteration, these methods mutate the vector in-place.
For that reason, these methods are much faster; between 35-55 times faster,
depending on the benchmark. They also generate permutations in lexicographical order.
src/libstd/slice.rs