Boost logo

Boost :

From: Keith MacDonald (boost_at_[hidden])
Date: 2003-09-28 15:00:30


Hi Thomas,

First off, apologies for posting this on the developer mailing list. I was
trying to use gmane.comp.lib.boost.user, so I don't know how that happened.

My real task is to iterate through a memory mapped file. The constraint on
Win32 is that MapViewOfFile is limited to a window no larger than the
maximum contiguous area of virtual memory. Therefore, the iterator will be
more complicated than a simple char*, but I decided to start with that, to
find out how iterator_adaptor worked.

You said "First rule of iterators: Don't derive from an iterator", and I'm
certainly looking for advice, but P.J. Plauger's library always derives
iterator from const_iterator, which is itself derived from a base class. If
someone can spell out exactly how iterator_adaptor should be used for
creating iterators in new container classes, I'm sure I'll not be the only
one to benefit.

Thanks,
Keith MacDonald

"Thomas Witt" <witt_at_[hidden]> wrote in message
news:3F771ED5.6090205_at_acm.org...
> Thomas Witt wrote:
>
> >
> > Hi Keith,
> >
> > Just a short remark, more to follow.
> >
> > Keith MacDonald wrote:
> >
> >>
> >> class const_iterator
> >> : public boost_const_iterator
> >
> >
> > This does not work, it never did and it never will. First rule of
> > iterators: Don't derive from an iterator.
>
> Ok, I messed up. This does work. But
>
> class iterator : public const_iterator { ... };
>
> does not.
>
> There is one thing I don't understand, why do you use ia at all.
> unsigned char* can be used as an iterator an AFAICS you do not adapt the
> underlying iterator in any way.
>
> Thomas
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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