--[[ @brief Removes and returns the smallest element on the heap.
     @return The smallest element on the heap (using the stored comparator function).
--]]

function Heap:Pop()
	local v = self[1];
	self[1] = self[#self];
	self[#self] = nil;
	self:_HeapifyTopDown(1);
	return v;
end
