From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-11-19 22:06:07
"John Torjo" <john.lists_at_[hidden]> wrote in message
> >>>>You can also manually set the beginning and end of a range:
> >>>>// ignore first and last 5 elements
> >>>>r.begin( v.begin() + 5);
> >>>>r.end( v.end() - 5);
> > In the rare cases where it is needed, one can easily copy both
> > What if the iterators are not random access? what if they are not
> > bidirectional?
> I don't see what this has to do with resetting begin() or end().
> Please explain.
well, if they are not random access, you can't do
r.set_begin( v.begin() + 5 );
if they are not bidirectional, you must do something like
r.set_end( std::advanece( r.begin(), size( r ) - 5 ) );
and it starts to get troublesome.
> Now, take a look at generated_range, which adapts a functor into a range.
> This is pretty cool, and I see lots of places where that can be used.
rng::copy( generated(step(), gen_n(10)),
how does this relate to the generator_iterator already part of boost? Or the
new iterators described in
It's not that I don't believe you, I just don't have too much time figuring
out how something can be used
and why is it better than something we already got. If you wrote a design
that explained why it was better than all known things on earth, it would be
much easier for me to see.
In the above code, I have a lot of unanswered questions, eg.
why can't I say 10 instead of gen_n( 10 ) ? What's the performance of this
compared to other implementations.
I'm not sure, but I think functional C++ has a lot of similar stuff.
What if I don't want the range [0,9] but [1,10] ?
How is it better than this stuff I once wrote:
I'm thinking about the enum stuff or n_genereted_by.
That is why I really need to see some docs. It will save both of us a lot of
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk