Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge two std::queue

Tags:

c++

stl

Is there any function in stl that joins two std::queue objects?

like image 671
userbb Avatar asked May 02 '11 20:05

userbb


1 Answers

The std::queue adapter doesn't support iteration so you'd actually have to roll your own method to do this. But given that you need this functionality, you should probably consider a different container. If you need random access, the probably std::deque. If you only need front/back access like a queue consider std::list which can be spliced together in constant time.

like image 51
Mark B Avatar answered Oct 15 '22 01:10

Mark B