Boost logo

Boost :

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


on Sat Jul 25 2009, Steven Watanabe <watanabesj-AT-gmail.com> wrote:

> AMDG
>
> David Abrahams wrote:
>> on Fri Jul 24 2009, Andrei Alexandrescu <andrei-AT-metalanguage.com> wrote:
>>
>>> Another example of an iterator-based design that's not easy to
>>> replicate with ranges is Boost Multi-Index. (Thanks Emil Dotchevski
>>> for pointing that out during my talk. (Marshall Clow promised the
>>> video will be available Real Real Soon Now(tm).)) In Multi-Index,
>>> indexes store iterators; storing ranges would often waste twice the
>>> space for little or no benefit.
>>>
>>
>> Can't you handle that by storing a range that always contains only one
>> element: [iterator,iterator+1)?
>>
>
> How would you implement popFront() without storing
> two iterators, an iterator and a bool, or something?

popFront needs to be allowed to return a different range type, I guess.
OK, that complicates the abstraction.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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