Bug 12123 – heap.pop

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-09T13:45:24Z
Last change time
2017-08-25T10:36:47Z
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-02-09T13:45:24Z
This is a split from Issue 5462 . In code that uses the BinaryHeap I often use two lines of code like (note it use removeFront and not popFront): auto item = heap.front; heap.removeFront; So I suggest to add to BinaryHeap a handy member function pop() that does both things: auto item = heap.pop; (In a dynamic array a pop() should call back+popBack, so it's a function specialized for heaps.) See also: http://stackoverflow.com/questions/12600330/pop-back-return-value http://ptgmedia.pearsoncmg.com/images/020163371x/supplements/Exception_Handling_Article.html http://www.gotw.ca/gotw/008.htm
Comment #1 by razvan.nitu1305 — 2017-08-25T10:36:47Z
See issue 9502.