Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

FIFO Queue or Stack with peek option?



  • I'm looking for a Queue or Stack that has a peek option, what I mean by this is I want to look at the next location that could be popped off but leave it in the Queue until such time as I have verified that the item I've retrieved has been successfully used.

    To give context. The Queue is a list of items to transmit, I want to only take them out of the queue once they have been successfully transmitted.

    I've looked at both QQueue and QStack and both have very similar functionality but neither seem to have the option to read an item without removing it from its place in the object.



  • if you look at std::deque you will see items to examine the front and back without actually popping them. in fact object removal is a discrete operation...so at any given time you could track the last popped item and the current item existing on either end of the list.

    and what about QQueue::head() ?



  • if you look at std::deque you will see items to examine the front and back without actually popping them. in fact object removal is a discrete operation...so at any given time you could track the last popped item and the current item existing on either end of the list.

    and what about QQueue::head() ?


Log in to reply