|
Boost Users : |
Subject: Re: [Boost-users] iterators must go
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-05-16 01:45:37
On Fri, May 15, 2009 at 17:15, Daniel James <daniel_james_at_[hidden]> wrote:
>
> The relevant point is that bringToFront's first range can step over
> the second range.
>
I'm very curious how that's supposed to work. What if, for example,
the second range is a superset of the first? Or, since they can be
two different types, what happens if I do the same thing as the above,
but "retro" one or both of the ranges? It just sounds brittle to me.
Or, even simpler, how do I do this?
size_t strnlen(char *p, size_t n) {
return find(p, p+n, '\0') - p;
}
That's the size of a range, but I don't know how to get that range.
Perhaps it really means that find should be a certain kind of split,
not a reducer:
size_t strnlen(char *p, size_t n) {
auto rr = find( make_range(p, n), '\0' );
return rr.first.size();
}
But then what if I want the range before the k-th occurance of
something? Then I'd have to somehow concat all the front ranges,
which would give me who knows what type.
It feels like n iterators gives you n*n different ranges, but that
there's no obvious way to get them from n ranges.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net