|
Boost : |
Subject: Re: [boost] [iterator] Is there any interest in Null Iterator Adaptor ?
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2016-09-25 14:01:50
On 2016-09-25 19:19, Edward Diener wrote:
> On 9/25/2016 9:20 AM, Rahman Salim Zengin wrote:
>> Hi! It would be pleasure for me to hear about your precious thoughts.
>>
>> https://github.com/rszengin/null_iterator
>>
>> Best regards.
>
> What do you mean by "when it is used" ?
>
> The normal use of iterators is to traverse a sequence and return a
> value when dereferenced. I have a hard time fitting your nulliter
> adaptor into that functionality. Perhaps your docuemnetation needs to
> be more expansive about its functionality.
I agree an example is needed. I can not think of any example where i
would like to fool one of the std:: algorithms.
Moreover, note that this iterator will never fulfil the requirements of
a random access iterator even if it allows random access. Simply because
std::iterator_traits<It>::reference must be T& and thus *it must not
return a proxy object. Therefore it is not even a ForwardIterator.
Also more seriously i goubt you get distances right as for iterators a
and b must hold: b == a + (b - a)
Best,
Oswin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk