> I believe this fixes the segfault.
> 
> I can't tell you if the output is what you expect, though.
> 
> --- BufferIterator.cpp~       Mon May 10 10:47:10 1999
> +++ BufferIterator.cpp        Tue May 11 11:58:34 1999
> @@ -89,7 +89,7 @@
>  ostream & operator<<(ostream & o, BufferIterator const & b) {
>      o << "BufferIterator: ";
>      for (BufferIterator::path_type::const_iterator i= b.path.begin();
> -      i != b.path.end(); ++i) {
> +      i < b.path.end(); ++i) {
>       o << *i << " ";
>      }
>      return o;

Super!

You seem to have found it, and has proven yourself worthy of praise ;-)

I think the real problem is that operator != is not well defined for 
BufferIterator.  So, the correct (i.e. efficient) fix is to do

        !(i == b.path.end()); ++i) {

(Unfortunately, BufferIterator::operator< is potentially linear time,
while operator= is constant time.)

Of course, the better solution is to define the operator!= for BufferIterator 
to avoid this problem in the future.

Thanks a lot for finding this!

Did you read the documentation/code?  Any comments?

Thanks,

Asger

Reply via email to