nWayUnion fails when used with chunkBy with the following:
object.Exception@/home/justin/.dvm/compilers/dmd-2.071.1-b2/linux/bin/../../src/phobos/std/container/binaryheap.d(234): Cannot call front on an empty heap.
Using this test case:
import std.range, std.algorithm;
void main(string[] args)
{
auto ror = [
iota(1,3),
iota(2,3),
iota(1,3),
];
auto un = nWayUnion(ror).chunkBy!`a==b`;
import std.stdio;
writeln(un);
}
Altering https://github.com/dlang/phobos/blob/master/std/algorithm/setops.d#L812 to check `_heap.empty` seems to correct the problem, but raises the issue of how the _heap and _ror are getting out of sync. Removing the `chunkBy` from the test case also eliminates the issue, suggesting that it's the conjunction of the two.
Comment #1 by justin — 2016-06-13T23:16:53Z
The suggested fix in my previous comment actually just hides the issue in some situations. Changing one of the `iota(1,3)` lines in the test cases causes a popFront on an empty iota range.
Comment #2 by jrdemail2000-dlang — 2019-01-22T19:21:55Z
The PR I am working on for issue 19532 will likely fix this as well.
Comment #3 by jrdemail2000-dlang — 2019-01-30T06:35:36Z