I need to implement a priority queue for a project, but the STL\'s priority_queue
is not indicated since we need to iterate over all elements and remove them random
STL's set should be usable to make what you want, although I must note that the list of requirements looks a little strange. You could just define a new type.
template class impl_type = std::set> class prio_queue {
typedef impl_type set_type;
typedef typename set_type::iterator iterator;
// etc
public:
// Forward the set's members
T& top() {
return *begin();
}
// etc
};