Questions tagged [iterator]

An iterator is an object-oriented programming pattern which for the most part functions similarly to a pointer to an object inside a collection with the added ability to traverse through the collection in a defined manner, agnostic of the actual implementation or even object addresses in physical memory. Iterators may be further limited in particular traversal directions.

Filter by
Sorted by
Tagged with
4
votes
1answer
115 views

Skip_over() algorithm

I'm just curious if this is clear to the average person. ...
3
votes
2answers
442 views

Iterating over unequal unordered pairs in one collection

This code kinda hurts my feelings -- everything else in my code is done in neat one-liners, exploiting algorithms and, sometimes boost::bind, except for this piece. ...
9
votes
2answers
27k views

How can I avoid unchecked cast warning in my generic recursive Iterator?

It's somewhat odd that Java's collection framework has no iterator for recursive data structures. Since I needed something like this, I wrote my own. First off, I need recursive elements: ...
3
votes
4answers
4k views

Iterator pattern/iterator class

I have implemented a simple iterator. Just want to check if I have missed anything. ...
6
votes
1answer
3k views

Iterator over row and columns

I am writing a simple raytracer just for fun. I want to iterate over rows, and each row must be an iterator over columns. A strategy I produced is the following: ...
4
votes
3answers
552 views

LISP-like list class

So, here's my code: ...
2
votes
1answer
168 views

Can you make this Key-interable view of a List of Maps better?

I have a list of map entries, and I need an iterable that returns the keys. Of course, we could be naive and copy over into a new collection of the desired type, but that's inefficient. So let's ...
4
votes
3answers
2k views

Is ToIEnumerable<T> good practice?

I have an extension method that does this: ...
14
votes
2answers
607 views

Sudoku Grid special purpose Iterators

Please have a look at these iterators which I use for my Sudoku solver. They behave slightly different from STL iterators and don't implement all functionality that would be needed to use them in a ...