Namespaces
Variants
Views
Actions

Talk:cpp/algorithm/pop heap

From cppreference.com

[edit] Bug in description?

"Removes the first (largest) element from the heap defined by the range [first, last) and places it into the position last-1. The first version of the function uses operator< to compare the elements, the second uses the given comparison function comp."

Should that say [first, last-1)? Otherwise, I can't see how it won't overwrite the last element... 130.83.33.131 11:22, 22 November 2011 (PST)

Even better, I think, it should say "into the position last". 130.83.33.131 11:22, 22 November 2011 (PST)
The iterator last is the past-the-end iterator, it's impossible to write anything to the position "last". I'll edit for clarity. --Cubbi