On Mon, September 25, 2006 10:33, Xiaofeng Zhao wrote:
> 1. Line 51 of test085.cxx, I had to change from:
>
> for (ITER arg = --patend; i > 0; --arg, --i)
> {
> ...
> }
>
> to:
>
> for (ITER arg = patend; i > 0; --i)
> {
> --arg;
> ...
> }
Why is that? There shouldn't be any problem here--if there is nothing
valid before patend then I'd expect the loop condition (i > 0) to fail
right away, and the decrement would never be executed. I'll make the
change if that helps, but what's the error message here exactly?
> 2. Line 69 of test083.cxx need to be changed from:
>
> for (result::const_iterator r = R.begin(); r != R.end(); --i, ++r)
> ...
>
> to:
>
> ++i;
> for (result::const_iterator r = R.begin(); r != R.end(); ++r) {
> ...
> }
That's a very radical change to the loop. Are you sure there isn't some
mistake here? That should probably make the test fail because it will
make the test look at different data.
> Both changes are needed to prevent a (forward) iterator from decrementing
> past the first element.
There must be some confusion here... If they were forward iterators, then
they shouldn't be able to decrement at all! There should be a
compile-time error for that. And I think (perhaps wrongly--it's not
unheard of) that in the case of test085.cxx it's not possible for the
"--patend" to go below the beginning of the sequence. Even if it can,
doing the initial "--arg" instead should have the exact same problem!
Jeroen
_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general