Boost logo

Boost :

Subject: Re: [boost] AlRangeExandrescu?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-07-24 13:36:41


AMDG

David Abrahams wrote:
> on Fri Jul 24 2009, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org> wrote:
>
>> To be clearer, let's suppose I want to do the following with Alexandresuc ranges.
>>
>> range r = myrange;
>> for(range r = myrange; !r.empty(); r.popFront())
>> {
>> if(is_word_boundary(???, r))
>> {
>> // ...
>> }
>> }
>>
>> "???" could be something like complement(myrange, r) but I don't see how to implement
>> that generically other than linearly, and still that would require a primitive to
>> compare ranges.
>>
>> the iterator solution, however, is straightforward:
>>
>> for(iterator it = myrange.begin(); it != myrange.end(); ++it)
>> {
>> if(is_word_boundary(myrange.begin(), it, myrange.end())
>> {
>> // ...
>> }
>> }
>>
>
> That's a good question.
>

Looking at the D documentation, it looks like it can only
be done with a random access range, which supports
index based slicing.

In Christ,
Steven Watanabe


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