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.

What happens if you call erase() on a map element while iterating from begin to end?

In the following code I loop through a map and test if an element needs to be erased. Is it …

c++ stl iterator
Why does Java not allow foreach on iterators (only on iterables)?

Possible Duplicate: Why is Java's Iterator not an Iterable? Idiomatic way to use for-each loop given an iterator? Can we …

java syntax iterator language-design iterable
TypeError: zip argument #1 must support iteration

for k,v in targets.iteritems(): price= str(v['stockprice']) Bids = str(u''.join(v['OtherBids'])) Bids = Bids.split(',…

python-2.7 iterator typeerror
Checking value exist in a std::map - C++

I know find method finds the supplied key in std::map and return an iterator to the element. Is there …

c++ iterator find stdmap
Why use iterators instead of array indices?

Take the following two lines of code: for (int i = 0; i < some_vector.size(); i++) { //do stuff } And this: …

c++ for-loop stl iterator containers
C++ template typename iterator

Consider the following header file: template <typename T> struct tNode { T Data; //the data contained within this node …

c++ templates iterator typename
iterate vector, remove certain items as I go

I have a std::vector m_vPaths; I will iterate this vector and call ::DeleteFile(strPath) as I go. If …

c++ data-structures vector loops iterator
In-order iterator for binary tree

How can I write a Java iterator (i.e. needs the next and hasNext methods) that takes the root of …

java algorithm iterator binary-tree nodes
What does "three dots" in Python mean when indexing what looks like a number?

What is the meaning of x[...] below? a = np.arange(6).reshape(2,3) for x in np.nditer(a, op_flags=['readwrite']): …

python numpy iterator
Is it possible to do start iterating from an element other than the first using foreach?

I'm thinking about implementing IEnumerable for my custom collection (a tree) so I can use foreach to traverse my tree. …

c# iterator ienumerable