given:
1 2 3
|
for (<a>;<b>;<c>){
<d>
}
|
I understand that 'front()' can't be called on an empty queue. It should never be called on an empty queue though. As I mentioned, this for loop will only be reached if the queue has at least one element, making <a> safe. Once the queue is empty <c> should never be called.
I don't have a copy of the most recent standard, but I think it's fair to expect that the behavior of a for loop hasn't changed. Am I missing something?
jsmith:
The use of the loop in my program better fit the thought of a for loop, as I needed a one-time initialization, a check, and a change after each iteration. I changed it to a while loop with some extra housekeeping to make the code happy under both Windows and Linux, but I'd still like to understand why it wasn't working as initially written.
firedraco:
The current standard isn't published online. You can buy the current copy for $175 from ANSI, or $18 for a pdf version from:
http://webstore.ansi.org/ansidocstore/default.asp.
I've read rumors that there are formatting issues with the pdf version.
If you don't have a pressing need for the current standard, Stroustrup's website has some nice links, including the old draft standard.
http://www.research.att.com/~bs/C++.html
The 1998 version of the standard can be grabbed from here:
http://www.kuzbass.ru/docs/ansi_iso_iec_14882_1998.pdf
Unfortunately, I don't think either will give you insight into the STL.