Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-11-09 17:49:33


"Larry Evans" <cppljevans_at_[hidden]> wrote in message
news:cmrei9$229$1_at_sea.gmane.org...
| On 11/09/2004 03:10 PM, Robert Ramey wrote:
| [snip]
| >>>How is this simpler or more transparent than
| >>>
| >>>for(some_array::iterator i=some_array.begin(); i != some_array.end();
| >
| > ++i)
| [snip]
| >
| >
| > I see only the smallest difference here.
|
| Yes, as far as this example shows. I haven't look at other examples;
| however, I've coded this range idea myself just using something
| derived from pair<iterator,iterator>. There's was something
| already in boost that had ranges; however, I couldn't use it for
| some reason. I've also seen ranges coded elsewhere (in the polaris
| compiler at uiuc). If it's occurring so often, maybe it's worth
| having a library.
|
| Also, could someone tell me the reason for having, I believe
| Thorsten's, range library as well as this one?

John goes somewhat further and provides algorithms too. I do hope it can be
part of boost.range.

| I've found
| the Thorsten's hard to use because it doesn't have a dereference
| function or advance function. How can these operations be done
| on ranges in that library?

John goes one step further: he makes the ranges iterable, boost.range's ranges
are not. I have focused on the
core infrastructure used to define algorithms interfaces. If you want to use
them easier using John' stuff, you can do so:

crange< sub_range<string> > r = ....;

I admit that is not elegant. I do believe

crange<string> r2 = make_sub_range( r.begin(), r.end() );

should work.

I guess the next version could be made iterable if people want. In that sense
sub_range<> would replace crange<> in John's library. maybe John wouldn't
mind?

-Thorsten


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