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
std::q
Apart from what has been said already, you can clear a queue very easily:
queue q; ... q = queue(); // Assign an empty queue
or in C++11
q = {};