Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-29 09:29:20


----- Original Message -----
From: <nbecker_at_[hidden]>

> I was hoping to find a simpler example. One thing not clear to me is
> the first template parameter T. It says "operand type". In the
> example, it is set to "test_iter<T,R,P>", which is a self-reference.
> I'm confused.

The iterator helpers use the same idiom as the rest of the operators library
templates: the first parameter is the type to which you are adding the
operator functionality, i.e. the derived class. Don't worry; it's correct
and it works.

> David> FWIW, most people find the iterator helpers aren't that useful
now that we
> David> have the iterator adaptor library. It does a lot more to
automate the job of
> David> making correct and useful iterators.
>
> I'll have a look. I thought the adaptors were, well, adaptors. In
> this case, I'm not adapting an existing iterator, but making a new
> one, so I didn't think that the adaptors were applicable.

You can adapt anything; it doesn't have to be an iterator. Your iterator has
some state data, right? Just adapt that.

-Dave


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