dimanche 24 février 2019

Trying to use push_back()/pop_front() with a queue implemented as a deque

I'm trying to implement a queue as a deque and using the member functions push_back() and pop_front(), but my compiler is saying "class std::queue has no member named 'push_back'," and says the same for pop_front(). Is it possible to implement it this way?

Here is my code:

std::queue<int, std::deque<int> > queueDeque;
for (int i = 1; i <= 5; i++)
{
    timerStart = clock();

    for (int j = 0; j < 1000000; j++)
        queueDeque.push_back(j);
    for (int j = 0; j < 500000; j++)
        queueDeque.pop_front();

    timerEnd = clock();
    // then some cout stuff
}

Aucun commentaire:

Enregistrer un commentaire