About ranges and iterators again: implementing next_permutation

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jul 10 14:47:16 PDT 2011


On 7/10/11 4:35 PM, bearophile wrote:
> Max Klyga Wrote:
>
>> Several weeks ago Andrei mentioned at #d irc channel that he wanted
>> to implement next_permutation STL function in Phobos.
>
> What about instead a range, that given an array of items, yields
> lazily all its permutations, creating a new array each time on
> default, and using the same array on (compile-time) request?

Better yet, make it an input range that modifies the parameter in-place. 
Then creating new arrays etc. is easy on the user side.

Andrei


More information about the Digitalmars-d mailing list