Boost logo

Boost :

Subject: Re: [boost] [gil::io] Feedback for scanline_read_iterator
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2013-02-25 00:50:51


On Sun, Feb 24, 2013 at 9:25 PM, Michael Marcin <mike.marcin_at_[hidden]>wrote:

> Michael Marcin wrote:
>
>> Jeffrey Lee Hellrung, Jr. wrote:
>>
>>> On Sun, Feb 24, 2013 at 1:07 PM, Christian Henning
>>> <chhenning_at_[hidden]>wrote:
>>>
>>> Hi Michael,
>>>>
>>>> I moved the buffer creation internally.
>>>>>>
>>>>>>
>>>>> I think this might be even worse unfortunately, if the iterator is
>>>>>
>>>> copied, such
>>>>
>>>>> as with (*i++) it's going to make a full copy of the buffer. Now that
>>>>>
>>>> readers
>>>>
>>>>> have a begin and end maybe the reader could own the buffer?
>>>>>
>>>>
>>>> I see two ways, apart from moving the buffer into the reader. I could
>>>> use a shared ptr or the user has to pass the buffer into the
>>>> constructor. I lean towards the shared pointer. Do you have an
>>>> opinion?
>>>>
>>>>
>>> Does that mean all copies of an iterator share the same buffer? Won't
>>> that
>>> screw things up if iterators which share the same buffer are dereferenced
>>> from different positions in the image?
>>>
>>>
>> I don't think that is a valid use case for an InputIterator.
>>
>>
> Jeffrey Lee Hellrung, Jr. wrote:
> > Or, maybe having a shared buffer is okay if your iterators are only
> > advertised as input iterators or (equivalently, I think) readable +
> > incrementable.
>
> Ooops somhow missed this.
>
> Yes I believe it is an InputIterator.
>

Yeah that's the category that makes the most sense.

- Jeff


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