|
Boost : |
From: Noel Yap (yap_noel_at_[hidden])
Date: 2002-05-21 08:31:54
--- David White <dave_at_[hidden]> wrote:
Thanks for the feedback.
> I would suggest making iterator_n the same iterator
> category as the type
> it's adapting. This is so you can do something like:
>
>
distance(iterator_n(cont.begin()),iterator_n(cont.end(),n));
>
> and have it operate in constant time if cont is
> (say), a vector, and in
> order n time if cont is (say) a list.
>
> Also, I would make sure it can support input and
> output iterators as the
> base type, since this would also be useful.
I'm still working towards "expert" status with this
stuff, so could you give me a hint as to what I'd need
to do to have this work the way you describe above?
> Oh and yes, the class template wouldn't be called
> iterator_n, that's the
> name of a helper function template for easy
> generation of the iterators.
> Well, actually "iterator_n" is just a name off the
> top of my head, a
> better name could likely be thought of.
The name is least of my worries right now. If anyone
has another suggestion, I'll change it.
> Note that this might have efficiency implications
> compared to
> specialized algorithms, since an iterator_n object
> will be larger than a
> normal iterator, and it's copying will be mildly
> expensive.
Right. I was thinking call_traits may be used to gain
some memory efficiency (at the expense of speed
efficiency). Do you think this decision can be moved
into a policy?
Thanks,
Noel
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk