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: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 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: -------

Reply via email to