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
priority_queue
Do you really need a priority queue ?
You need iterate over all items and remove randomly -> linked list
If you need to keep the list sorted, sort it at the beginning and then, when inserting new item, use insertion sort (insert new item on right place).