On Tuesday, 13 September 2016 at 08:55:15 UTC, Nicholas Wilson wrote:
On Tuesday, 13 September 2016 at 08:19:04 UTC, Johan Engelen wrote:
In the binary heap documentation, I read that `BinaryHeap.front()` "Returns a copy of the front of the heap". [1] Is there no function to access the front of the heap without a copy? (micro-optimization)

Thanks,
  Johan

[1] https://dlang.org/phobos/std_container_binaryheap.html#.BinaryHeap.front

What does
foreach(ref e; bh)
{
     //...
}
do?

It copies the front of the heap on every iteration.

Reply via email to