Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-09-01 12:53:17


on Mon Sep 01 2008, "Giovanni Piero Deretta" <gpderetta-AT-gmail.com> wrote:

>>> You could provide an adapted_iterator and also an adapted_range.
>>
>> My point is that the adapted_range would then have semantically
>> equivalent iterators with a different representation (and an extra
>> indirection), which seems like a waste.
>
> hum, which indirection?

The iterators have to refer to the common data somehow.

> <...>
>>> Do you then still need a factored iterator?
>>
>> You need to be able to take two adapted iterators and turn them into a
>> range. Do you want that range to contain redundant data? I don't.
>
> Hei, maybe this is all that we need! Let's have a metafunction that
> given an iterator type returns its preferred range type (the
> associated range). The default might be boost.range or even std::pair.
> The developer of an iterator adaptor, can specialize the metafunction
> so that the associate range is the optimum representation for an
> iterator pair.
>
> Do you think this would be enough? It seems too simple to me, so
> probably I'm missing something...

It is quite attractive, I must say. I'll give it some thought.

-- 
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