Is there anyway to iterate STL queue ?

V

Vajira

I'm using a STL queue to store some data. But now I want to iterate it.
Is there anyway to iterate STL queue ?
 
M

Martin Ambuhl

Vajira said:
I'm using a STL queue to store some data. But now I want to iterate it.
Is there anyway to iterate STL queue ?
comp.lang.c++ is the appropriate group for that bloated language.
 
A

alexmdac

Vajira said:
I'm using a STL queue to store some data. But now I want to iterate it.
Is there anyway to iterate STL queue ?

If you'd asked in comp.lang.c++ I'd tell you to do this:

std::queue<int> q;
for( std::queue<int>::iterator i(q.begin()), end(q.end()); i != end;
++i )
{ /* ... */ }

or this:

std::for_each( q.begin(), q.end(), someFn );
but since this is comp.lang.c I can only say "what's STL?"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top