Unordered Element Pairs of a Range

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 7 02:12:51 PDT 2015


On Monday, 7 September 2015 at 09:06:05 UTC, Nordlöw wrote:
> Is there a range in Phobos for accessing all unordered 
> combinations of a range as:
>
> foreach (const i, const a; r)
> {
>     for (auto j = i + 1; j < r.length; ++j)
>     {
>         const b = r[j];
>         // Use a and b
>     }
> }
>
> excluding self-pairs, that is i != j

There is an open bug for that 
https://issues.dlang.org/show_bug.cgi?id=6788


More information about the Digitalmars-d-learn mailing list