I use the STL queue to implement BFS (width first search) on a chart. I need to click the node in the queue if that node no longer exists in the queue. However, the STL queue does not allow iteration through its elements , and therefore I cannot use the STL lookup function.
I can use the flag for each node to mark them when they are visited, and only click them when the flag is false, however I need to run BFS several times and after each time I will have to reset all the flags, so I used the counter instead flag, but I still would like to know if there is a standard way to search for an item in the queue.
source share