Defining my priority_queue like this,
priority_queue<int> parts(start, start+N, less<int>());
the following code won't compile
for(int t : parts){
...
}
Which leads me to question:
In C++11, are range based for loops allowed for std::priority_queue
?
In general, which structures are allowed to be iterated trough using a range based for-loop?
I know I can do pretty much the same thing like this:
while(!parts.empty()){
cout << "Next element: " << parts.top() << endl;
parts.pop();
}
Is it possible to iterate trough the queue nevertheless?