next_permutation and cartesian product for ranges?

bearophile bearophileHUGS at lycos.com
Tue Oct 9 15:22:24 PDT 2012


Steven Schveighoffer:

> Is there any advantage over having a function?  I'd think you 
> could easily build a range based on the function, no?

Generators (that yield lexicographic permutations, permutation 
swaps, combinations, etc) are quite more handy, you can compose 
them with the other ranges and higher order functions.

Adding to Phobos few ranges that build on a next_permutation(), 
next_combination(), etc, is possible, but I don't see a big need 
for such C++-style functions, the ranges are enough.

Bye,
bearophile


More information about the Digitalmars-d mailing list