Boost logo

Boost :

Subject: Re: [boost] AlRangeExandrescu?
From: David Abrahams (dave_at_[hidden])
Date: 2009-07-27 07:17:07

on Sat Jul 25 2009, Andrei Alexandrescu <> wrote:

> Thorsten Ottosen wrote:
>> Andrei Alexandrescu skrev:
>>> Mathias Gaunard wrote:
>>>>> You would pass two adjacent ranges, like D's bringToFront (a generalization of
>>>>> STL's rotate, see
>>>>> 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?
> Yes, but not within the current primitive set. Sebastian's suggested interface
> extension should work.

That isn't necessarily a good idea, though. Complicating the Range
abstraction undermines one of the best arguments in favor of the Range

Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at