You can use std::set as a priority queue without duplicates. The top element can be found through rbegin() . The asymptotic complexity is the same as for the binary heap: O (1) top according to the Standard requirements for rbegin , O (log n) push and O (log n) pop . However, the constants will be higher.
As for the filter, I suggest you wrap std::set in a class using a custom push method (which is a good idea anyway) that launches the filter predicate for you.
source share