Binary heap: obtain a _reference_ to the front of the heap
Johan Engelen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 15 02:12:47 PDT 2016
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)
Answering myself here: the binary heap element type should be
cheap to copy, because it is going to be copied around a lot (for
the common implementation on top of an array).
More information about the Digitalmars-d-learn
mailing list