With thanks to @JadenGeller, land the following minor API improvements in Heap:
Mark removeMin() and removeMax() as @discardableResult, emulating removeFirst()/removeLast() in the stdlib.
Add a reserveCapacity() implementation that simply forwards to the similar method on the heap's array storage.
Also add an init(minimumCapacity:) initializer that reserves capacity during heap creation. (This is generally a better idea than calling reserveCapacity on an already existing heap -- as it avoids getting called in a loop.)
With thanks to @JadenGeller, land the following minor API improvements in
Heap
:removeMin()
andremoveMax()
as@discardableResult
, emulatingremoveFirst()
/removeLast()
in the stdlib.reserveCapacity()
implementation that simply forwards to the similar method on the heap's array storage.init(minimumCapacity:)
initializer that reserves capacity during heap creation. (This is generally a better idea than callingreserveCapacity
on an already existing heap -- as it avoids getting called in a loop.)Checklist