[Issue 12123] New: heap.pop
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 9 13:45:26 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12123
Summary: heap.pop
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2014-02-09 13:45:24 PST ---
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
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list