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.

Vector erase iterator

I have this code: int main() { vector<int> res; res.push_back(1); vector<int>::iterator it = …

c++ vector iterator
Iterator invalidation rules

What are the iterator invalidation rules for C++ containers? Preferably in a summary list format. (Note: This is meant to …

c++ c++11 iterator c++17 c++-faq
Iterate over the lines of a string

I have a multi-line string defined like this: foo = """ this is a multi-line string. """ This string we used as test-input …

python string iterator
Difference between Iterator and Listiterator?

Iterator ite = Set.iterator(); Iterator ite = List.iterator(); ListIterator listite = List.listIterator(); We can use Iterator to traverse a Set …

java list iterator set listiterator
what is the difference between const_iterator and iterator?

What is difference between these two regarding implementation inside STL. what is the difference regarding performance? I guess when we …

c++ stl iterator const-iterator
Iterating C++ vector from the end to the beginning

Is it possible to iterate a vector from the end to the begin? for (vector<my_class>::iterator …

c++ vector iterator
Iterating over and deleting from Hashtable in Java

I have a Hashtable in Java and want to iterate over all the values in the table and delete a …

java iterator hashtable
Returning a pointer to a vector element in c++

I have a vector of myObjects in global scope. I have a method which uses a std::vector<myObject&…

c++ pointers containers iterator
Fastest way to convert an iterator to a list

Having an iterator object, is there something faster, better or more correct than a list comprehension to get a list …

python iterator list-comprehension
How do I write a for loop in bash

I'm looking for the basic loop like: for(int i = 0; i < MAX; i++) { doSomething(i); } but for bash.

bash for-loop iterator