Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-27 01:20:00

David Abrahams wrote:

> Vladimir Prus <ghost_at_[hidden]> writes:
>>>> but it that I'm not sure what operator++(int) should return...
>> That's the important question. Writable non-lvalue iterator cannot return
>> a proxy storing the value inside, since there's no value to store. So
>> making iterator_facade return proxy with stored value for all non-lvalue
>> iterators is too simple solution :-(
> Actually I think a proxy storing the iterator_facade's "reference"
> type is probably enough. Think about it.

For writable iterators, that's fine (well, provided it's required that
return type of *a is iterator_traits<X>::reference).

For readable iterators, you have to store value_type, not reference, since
if you store reference, *r++ won't work.

The question is how to distinguish between readable and writable iterators.
Maybe, using 'is_convertible' on the reference type?
BTW, are there any examples of writable iterator made with iterator facade?

- Volodya


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