+ Reply to Thread
Results 1 to 2 of 2

Thread: How to merge two stl queue objects?

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    37

    How to merge two stl queue objects?

    Hi,

    I have two different queue objects:

    Code:
    void UseQueue()
    {
    	std::queue<int> myQueue1 ;
    
    	myQueue1.push(1) ;
    	myQueue1.push(2) ;
    
    	std::queue<int> myQueue2 ;
    
    	myQueue2.push(3) ;
    	myQueue2.push(4) ;
    	myQueue2.push(5) ;
    }
    How to merge them?

  2. #2
    There is no iterator for queue!

    So you will need to get items from one queue on your own and then push them in another one.

    Another option is using 'dqueue', 'vector' or 'list' or any other STL container you may want.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts