[
https://issues.apache.org/jira/browse/TS-4537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15331145#comment-15331145
]
Masaori Koshiba commented on TS-4537:
-------------------------------------
> We have to rewrite the index for the remaining either way (since this is
> intentionally removing an item).
Yes, if we remove an entry using {{Vec<C, A, S>::remove_index(int index)}}.
But I mean we can avoid using this too. My suggestion is below.
{code}
template <typename T, typename Comp>
void
PriorityQueue<T, Comp>::erase(PriorityQueueEntry<T> *entry)
{
if (empty()) {
return;
}
_v[entry->index] = _v[_v.length() - 1];
_v.pop();
_bubble_down(entry->index);
_bubble_up(entry->index);
}
{code}
> Add erase to PriorityQueue
> --------------------------
>
> Key: TS-4537
> URL: https://issues.apache.org/jira/browse/TS-4537
> Project: Traffic Server
> Issue Type: New Feature
> Reporter: Thomas Jackson
> Assignee: Thomas Jackson
> Fix For: 7.0.0
>
>
> The priorityqueue (really more of a sorted list...) doesn't have an erase
> method-- we probably should have one :)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)