|
Boost : |
Subject: Re: [boost] AlRangeExandrescu?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-07-24 11:55:58
Mathias Gaunard wrote:
>> You would pass two adjacent ranges, like D's bringToFront (a
>> generalization of STL's rotate, see
>> http://www.digitalmars.com/d/2.0/phobos/std_algorithm.html) takes.
>
> Nice idea, that could work.
> But how can I generate those two adjacent ranges in the first place at
> reasonable costs? Do ranges requires to provide a constant time
> "complement" primitive?
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())
{
// ...
}
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk