Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How's the thing iterated over called?

I wanted to express that an iterator is const (i.e you cannot increment or decrement it) but that the thing it yields is non-const:

iterator const it = foo.begin();
it++; // error
*it = ...; // not an error

If iterator is a pointer, I can say:

pointer // the iterator

pointee // the thing it yields

But if it is not a pointer, I'm not sure. I thought about using container for the "pointee" substitute, but a iterator is not tied to a container at all. For example an input iterator can be tied to a file or to STDIN. Does the following work and is used by others?

iterator // the iterator

iteratoo // the thing it yields

I'm glad for any guidance!

like image 958
Johannes Schaub - litb Avatar asked Dec 29 '25 02:12

Johannes Schaub - litb


2 Answers

Is "the value" too obvious (or wrong)? After all, what you want out of the iterator is the value. If you are referring to the set of values that you are iterating over then I think "sequence" is not a bad choice.

like image 143
Joris Timmermans Avatar answered Dec 31 '25 15:12

Joris Timmermans


Posting this here since we discussed this in the chat.

Use the victor/victim setup.

Iterator / Iteratim

Or you could use Iteratee.

like image 33
Ólafur Waage Avatar answered Dec 31 '25 16:12

Ólafur Waage