digitalmars.D.learn - Unordered Element Pairs of a Range
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (11/11) Sep 07 2015 Is there a range in Phobos for accessing all unordered
- cym13 (3/14) Sep 07 2015 There is an open bug for that
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (6/8) Sep 07 2015 Thanks.
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
Sep 07 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 != jThere is an open bug for that https://issues.dlang.org/show_bug.cgi?id=6788
Sep 07 2015
On Monday, 7 September 2015 at 09:12:53 UTC, cym13 wrote:There is an open bug for that https://issues.dlang.org/show_bug.cgi?id=6788Thanks. So I construct a pairwise range with two implementation cases one for RandomAccessRange and one for InputRange https://github.com/nordlow/justd/blob/master/combinations.d#L172 Should this go into Phobos?
Sep 07 2015