Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-09-02 15:15:25


Dan Eloff <dan.eloff_at_[hidden]> writes:

> Yes, it was a bit of a simplification on the real iterator that was
> causing the problem, but I forgot that I hadn't implement post
> increment correctly. At the time I didn't see how it would get me into
> trouble, now I do :) My input iterator is a little tricky to create
> because I don't know how many times it can be incremented before
> reaching the end. The end() iterator simply holds a NULL pointer,
> incrementing it does nothing. When the begin() iterator is incremented
> enough I set it's pointer to NULL and it becomes equal to end(). This
> causes a lot of non-standard issues ( like end() == end()+1 ). I'm
> hoping that particular one doesn't cause a problem for me.

Just use boost::iterator_facade to implement your iterator and myriad
issues will disappear.

> Again it seems the trouble is with me rather than Boost::Python.
> Thanks for setting me straight, you saved me a lot of debugging time.

You're welcome.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk