Top "Iterator" questions

An iterator is an object-oriented programming pattern that allows traversal through a collection, agnostic of the actual implementation or object addresses in physical memory.

Most efficient way to loop through an Eigen matrix

I'm creating some functions to do things like the "separated sum" of negative and positive number, kahan, pairwise and other …

c++ performance iterator eigen
Can I access the elements in a c++ std::map by an integer index?

I have a map of elements that I would like to iterate through. Of course, the standard way to do …

c++ dictionary iterator openmp stdmap
If range() is a generator in Python 3.3, why can I not call next() on a range?

Perhaps I've fallen victim to misinformation on the web, but I think it's more likely just that I've misunderstood something. …

python python-3.x iterator generator typeerror
Replacing elements in vector using erase and insert

void replace(vector<string> my_vector_2, string old, string replacement){ vector<string>::iterator it; for (it = …

c++ vector insert iterator erase
How can I iterate over two vectors simultaneously using BOOST_FOREACH?

I'd like to replicate the following with BOOST FOREACH std::vector<int>::const_iterator i1; std::vector<…

c++ boost iterator boost-foreach
Using std::deque::iterator (in C++ STL) for searching and deleting certain elements

I have encountered a problem invoking the following code: #include<deque> using namespace std; deque<int> …

c++ stl iterator deque
Iterable objects and array type hinting?

I have a lot of functions that either have type hinting for arrays or use is_array() to check the …

php iterator type-hinting
Java: why can't iterate over an iterator?

I read Why is Java's Iterator not an Iterable? and Why aren't Enumerations Iterable?, but I still don't understand why …

java iterator iterable
C#: yield return within a foreach fails - body cannot be an iterator block

Consider this bit of obfuscated code. The intention is to create a new object on the fly via the anonymous …

c# iterator yield
Java HashMap add new entry while iterating

In a HashMap map = new HashMap<String,String>(); it = map.entrySet().iterator(); while (it.hasNext()) { entry = it.next(); …

java iterator concurrentmodification