Why does BinaryHeap sometime cause compile-error in foeach?

2017-09-30 Thread Shigeki Karita via Digitalmars-d-learn
https://dpaste.dzfl.pl/cd605899d050 why this code cannot convert to foreach (over Structs and Classes with Ranges). auto h = new BinaryHeap!(int[])(new int[0]); typeof(h).stringof.writeln; static assert(isInputRange!(typeof(h))); h.insert(3); h.insert(1); h.insert(2);

Re: Why does BinaryHeap sometime cause compile-error in foeach?

2017-09-30 Thread user1234 via Digitalmars-d-learn
On Saturday, 30 September 2017 at 09:27:23 UTC, Shigeki Karita wrote: https://dpaste.dzfl.pl/cd605899d050 why this code cannot convert to foreach (over Structs and Classes with Ranges). auto h = new BinaryHeap!(int[])(new int[0]); typeof(h).stringof.writeln; static assert(isInputR

Re: Why does BinaryHeap sometime cause compile-error in foeach?

2017-09-30 Thread Shigeki Karita via Digitalmars-d-learn
Oh, struct/class semantics really confuses me!