how to access the vector of queues in two functions

hi i have the following code which will find the minimum size queue among a vector of queues and the minimimum size queue will enqueue(push) the int

1
2
3
4
5
6
7
8
9
std::vector<std::queue<int> > q
void enqueue(){
int min_index = 1;
std::size_t size = q.size();
for( i=2; i<size; i++) //accessing loop of queues
    if(q[min_index].size() > q[i].size())
        min_index = i; // Now q[min_index] is the shortest queue
 q[min_index].push(int)
}

now my another paradigm is to do the dequeue(pop) operation in another function(shown below), bt i need to access all vector of queues declared in enqueue() function. how can i aceess the loop of queues given in the enqueue() function?
1
2
3
4
5
void dequeue(){

//q.pop operation , access all the queues in the loop of queues

}

willq[i].pop(int); access all the queues in the enqueue function and does the pop operation?
Last edited on
1
2
3
4
5
6
void dequeue()
{ 
std::size_t size = q.size(); 
for( i=0; i<size; i++){ 
q[i].pop(int) 
}


will this one does the required for all the queues?
Topic archived. No new replies allowed.