[iterator] Is there any interest in Null Iterator Adaptor ?
Hi! It would be pleasure for me to hear about your precious thoughts. https://github.com/rszengin/null_iterator Best regards.
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.
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
On 2016-09-25 19:19, Edward Diener wrote:
... Perhaps your docuemnetation needs to be more expansive about its functionality.
... I can not think of any example where i would like to fool one of >
On 2016-09-25 21:01, Oswin Krause wrote: the std:: algorithms.
Moreover, note that this iterator will never fulfil the requirements of a random access iterator even if it allows random access. ...
Documentation is improved. Descriptions are corrected. Examples are added.
On 9/26/2016 7:30 AM, Rahman Salim Zengin wrote:
On 2016-09-25 19:19, Edward Diener wrote:
... Perhaps your docuemnetation needs to be more expansive about its functionality.
... I can not think of any example where i would like to fool one of >
On 2016-09-25 21:01, Oswin Krause wrote: the std:: algorithms.
Moreover, note that this iterator will never fulfil the requirements of a random access iterator even if it allows random access. ...
Documentation is improved. Descriptions are corrected. Examples are added.
A big flaw is that it is impossible to distinguish a default constructed value from a nulliter. A possible solution to this is optional.
participants (3)
-
Edward Diener
-
Oswin Krause
-
Rahman Salim Zengin