I'm trying to look for a substitute in std::vector in my project, and I found out that std::queue is what I'm looking for.
I have lots of function that uses range-based loop for iteration and I'm trying to maintain it as far as I can.
I try to compile a range-based loop in std::queue but all I get are compile errors
error: no matching function for call to 'begin(std::queue&)'
Doesn't std::queue support range base loop?
I did try Google search but didn't find any topic regarding to this.
Update:
My compiler is GCC v4.7.1
-std=c++11 is enabled
And here's the faulty test code:
std::queue<int> Q;
for (int i = 0;i < 10; ++i)
Q.push(i);
std::cout << "\nqueue contains: ";
for (auto i : Q)
std::cout << i << ", ";