|
Boost : |
From: Ben Bear (benbearchen_at_[hidden])
Date: 2007-11-13 01:50:13
2007/11/13, Hervé Brönnimann <hervebronnimann_at_[hidden]>:
> Ben: the naming partial_permutation would be a very good idea. I
> like it. Am I correct that your (very cute!) idea would be extended
> to prev_ as follows:
>
> bool next_partial_permutation(first, middle, last)
> {
> reverse (middle, last);
> return next_permutation(first, last);
> }
>
> prev_partial_permutation (
> {
> bool result = next_permutation(first, last);
oh, here should be:-)
bool result = prev_permutation(first, last);
> reverse (middle, last);
> return result;
> }
>
> That's all good, then. BTW, you *should* assume that the client has
> already sorted the range. In other words, garbage in, garbage out,
> and that's OK. There's not reason to penalize those who keep their
> ranges sorted. It simply needs to be documented as a Requirement:
> and given again as a Post-condition: (since the functions maintain
> the sorted range invariant).
>
ok, I will prepare a resume source code that contains
partial_permutation and combination, but without initializatons. It
will be very simple, against gacap.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk