From: Hartmut Kaiser (HartmutKaiser_at_[hidden])
Date: 2005-02-09 13:17:29
Doug Gregor wrote:
> Even dereferencing *last could be a bug, if it is
> past-the-end. For iterators referencing contiguous memory
> (vectors and pointers only, as you've said), one would need to write
> scanner.last = scanner.first + std::distance(first, last);
Duh, just another bug! I'll fix that asap.
The re2c lexing component has to be rewritten to make proper use of
iterators anyway. That's already on my todo list for some time.
> > I really have to say Dinkumware did a fine job here, this
> would have
> > been very hard to find without these checks.
> FWIW, STLport and newer versions of GCC (Apple GCC 3.3, FSF
> GCC 3.4) have similar debugging modes. They've been
> invaluable in rooting out subtle bugs like those that stem
> from iterator invalidation.
Nice to know!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk