I have requirement: for a function, I get the input as a stream of numbers. I mean, the function keeps on getting called with single number in each call. I am using std::q
queue is just an adapter for some underlying container, by default a deque, with restricted function (as you noted here). If you want the full blown function use the underlying deque instead of queue.