3 ms·
I think you are arguing that iterators are "primarily" for iteration. But in C++ they really are like an abstraction over C pointers. For example, you can hold
by millstone 6y ago
I think you are arguing that iterators are "primarily" for iteration. But in C++ they really are like an abstraction over C pointers. For example, you can hold a std::list::iterator, and use it to efficiently delete from a linked list, without ever iterating.
Sometimes C pointers are used for iteration, but I would not say that is their primary purpose.
- jhayward 6y ago> I think you are arguing that iterators are "primarily" for iteration I really wonder why people put up with something named this way then. "That fool thinks iterators are for iteration!" Clarity of abstraction and good naming are important, unless the practitioners are masochists.
- gpderetta 6y agoCursor would be a better name probably, but I wouldn't say the name is misleading, as iteration is an important use case.