Original Post
I've been using a std::priority_queue to maintain the order of my task and I've come to a case where I want robin-round scheduling for equal priority task. Whenever a task is scheduled it is removed from the queue and re-added if it is to run again, so if the sort of the queue was stable this would result in round-robin scheduling. Problem is the priority queue use a heap (and heaps are not stable). I know there's stable_sort, but I don't want to completely resort the list when I add a node. Is there an insertion sort algorithm or something else I can use to create a stable priority queue?