[GiNaC-list] Use of STL iterators in GiNaC

Michael Goffioul michael.goffioul at gmail.com
Thu Apr 16 16:48:55 CEST 2009


On Thu, Apr 16, 2009 at 3:02 PM, Jens Vollinga <jensv at nikhef.nl> wrote:
>> In 24.1.4, the pre condition for --r is that there exists s such that r ==
>> ++s.
>> For ++s to be valid, s must be dereferenceable, so s cannot be before
>> begin().
>> Moreover, the post condition is that r is dereferenceable (there seems to
>> be
>> a typo in the version I have, which says s is dereferenceable, but this
>> doesn't
>> make sense), so r cannot be before begin().
>
> I agree. Actually, I agreed -- halfheartedly ;-) -- already in my last mail
> (see citation above). But I am not sure about the reverse iterator fix
> anymore.

The reverse iterator will be bound between its own begin() and end(),
which translates into "last element" and "prior-the-start element".
This may or may not help in fixing the code, but I don't have any
clue about that.

>> My general understanding is:
>> 1) you cannot go before begin()
>> 2) you can go after the last element, but only by an offset of 1, which
>> corresponds to end()
>
> 100% agreement, now. Thanks for the clarification!

No problem. I'm glad we agree now.
Note that I'll produce a patch in the coming days with fixes for
all the issues that popped up while trying to run the test suite,
but there might actually be other issues that didn't show up.

Michael.


More information about the GiNaC-list mailing list