About 6,910,000 results
Open links in new tab
  1. What are iterator, iterable, and iteration? - Stack Overflow

    Mar 27, 2012 · So an iterable is an object that you can get an iterator from. An iterator is an object with a next (Python 2) or __next__ (Python 3) method. Whenever you use a for loop, or map, …

  2. How to correctly implement custom iterators and const_iterators?

    Aug 27, 2010 · e.g. iterator begin(){return iterator(&m_data[0]);}; e.g. const_iterator cbegin()const{return const_iterator(&m_data[0]);}; We're Done!!! Finally, onto defining our …

  3. java - What is the difference between iterator and iterable and …

    Jul 28, 2011 · And Iterable, Collection and List just declare abstract method 'iterator()' and ArrayList alone implements it. I am going to show ArrayList source code with 'iterator()' method …

  4. Difference between Iterator and Spliterator in Java8

    Jul 21, 2018 · Spliterator == Splittable Iterator: it can split some source, and it can iterate it too. It roughly has the same functionality as an Iterator, but with the extra thing that it can potentially …

  5. Incrementing iterators: Is ++it more efficient than it++?

    Oct 26, 2018 · The reason is that if the iterator class itself is at all complex, then because it++ has to return the value before it is incremented, the implementation will generally make a copy. …

  6. iterator - What does the "yield" keyword do in Python? - Stack …

    Oct 24, 2008 · See my references above, but in summary: an iterable has an __iter__ method returning an iterator. An iterator additionally provides a .__next__ method, which is implicitly …

  7. Newest 'Iterator' Questions - Stack Overflow

    The iterator has a large len so collecting the iterator and then writing the resulting vector isn't very ...

  8. Iterate through a C++ Vector using a 'for' loop - Stack Overflow

    Oct 3, 2012 · i.e., if you go from a std::vector to a std::list, or std::set, you can't use numerical indices to get at your contained value. Using an iterator is still valid. Runtime catching of …

  9. Which is more efficient, a for-each loop, or an iterator?

    One reason to use the old C-style loop rather than the Iterator approach, regardless of whether it's the foreach or the desugar'd version, is garbage. Many data structures instantiate a new …

  10. c++ - What is an iterator in general? - Stack Overflow

    Jul 30, 2018 · This template-written function knows how big the iterator is, what the operations do, can inline the operations and store instances of the iterator in buffers or on the stack as a …