Subject: Re: [boost] AlRangeExandrescu?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-07-25 03:47:01
Andrei Alexandrescu skrev:
> 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?
> There's no such need (a range could define it though).
> A design that has a bidirectional iterator walking freely up and down
> between two limits would be difficult to port to ranges. (If the
> iterator is random-access, things are trivial.) Ranges can only shrink,
> they never grow unless assigned from the outside. So when you move one
> direction it would be difficult to grow one range (shrinking the other
> is easy). That design would benefit from letting the iterator
> abstraction exposed.
Couldn't it be done with a special range that stores three iterators?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk