Good container to insert? C ++

Hi, I was wondering what is the best container for inserting items in order? It seems to me that the map is not needed, since I'm just going to access the element in front, pushing it out and then inserting more elements (I implement the path search algorithm (Dijkstra) with weights)

Perhaps I could use the list and put it in order myself, but the inability to split in half (because you are starting to access front or back) will hinder performance.

+3
source share
2 answers

If you only need front and rear access, std::deque(double line) is great for counting.

However, for Dijkstra’s algorithm, you don’t need a priority queue?

+2

++, <queue> std::priority_queue.

+2

All Articles