Why doesn't std::queue support a clear() function?

前端 未结 4 787
感情败类
感情败类 2021-02-01 16:12

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

4条回答
  •  粉色の甜心
    2021-02-01 16:42

    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.

提交回复
热议问题