next_permutation and cartesian product for ranges?

Timon Gehr timon.gehr at gmx.ch
Tue Oct 9 14:30:31 PDT 2012


On 10/09/2012 11:23 PM, bearophile wrote:
> Andrei Alexandrescu:
>
>> Yes, we need next_permutation. It will be up to you to convince the
>> Grand Inquisition Committee of Reviewers that next_even_permutation is
>> necessary and/or sufficient.
>
> I don't like the design of C++ STL here. Instead of a
> next_permutation(), what about ranges that yield all permutations, all
> adjacent permutations, all combinations?
>
> [snip code]

I agree that that's better conceptually, but your implementations have
overflow issues. (And it is not too obvious how to fix that, given the
existing range design.)


More information about the Digitalmars-d mailing list