From: John Torjo (john.lists_at_[hidden])
Date: 2003-11-20 12:33:29
>>>>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);
>>>> std::cout << *r++ << std::endl;
>>>why not just make a new one providing the smaller range as arguments to
>>He he. This is one of the areas about which John and I are still in
>>I'm in favour of the simplest-is-best, but John favours the resettable
>>ranges. John's got more "hand", though, since he's done most of the work.
> In the rare cases where it is needed, one can easily copy both iterators.
> What if the iterators are not random access? what if they are not
I don't see what this has to do with resetting begin() or end().
> this would have a bit the functionality of counting_iterator, right?
> your concept seems a bit like iterators in Java
> while( c.hasNext() )
> iterator i = c.next(); ...
In this case, yes.
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.
Much more general than ::std::generate, and ::std::generate_n.
(see the using_generate.cpp examples)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk