Iterating through std queue

Posted by Ockonal on Stack Overflow See other posts from Stack Overflow or by Ockonal
Published on 2010-06-01T14:16:18Z Indexed on 2010/06/01 14:23 UTC
Read the original article Hit count: 169

Filed under:
|
|
|

Hi, I'm trying to use BOOST_FOREACH for iterating through the std::queue. But there isn't iterators in that class cause I have an error:

std::queue<std::string> someList;
BOOST_FOREACH(std::string temp, someList)
{
   std::cout << temp;
}

>no matching function for call to begin(...)
>no type named ‘iterator’ in ‘class std::queue<std::basic_string<char> >’

I need in structure like: the first comes, the first goes away.

© Stack Overflow or respective owner

Related posts about c++

Related posts about iterator