Indexed priority queue (source code)

= Indexed priority queue

A <priority queue> whose entries have stable identifiers and an auxiliary map from each identifier to its current storage location. An indexed <binary heap> can therefore support membership and locating an entry in constant time, followed by a key decrease in logarithmic time. Every heap swap must update both affected map entries; otherwise later updates can modify the wrong item.