iterator tag

6 questions


1 answers
110 views
0
There is something I don't understand about the code that contains the C++ iterator.(Difficulty level: Beginner)

Result of code: Question: Although I lack the concept of itator, I'm studying how to write while looking at the code to get a better sense of it.I don't understand the code below in the last for state...

2 years ago

1 answers
92 views
0
How do I eterate multiple iterables at the same time?

When there are two iterables, each element is paired foo = (1,2,3)bar = (4,5,6)for (f,b) in some_iterator(foo, bar): print f: , f ,; b: , bUse this code to make a result f: 1; b: 4f: 2; b: 5f: 3; b: 6...


1 answers
101 views
0
Why do you use an editor, not an index?

//code1for (int i = 0; i < some_vector.size(); i++){ //...}//Code2for (some_iterator = some_vector.begin(); some_iterator != some_vector.end(); some_iterator++){ //...}Usually, when you use a conta...

2 years ago

1 answers
101 views
0
If you use Java Iterator, you fall into an infinite loop.

If you do it like this, it's printed indefinitely. What's wrong with this?I don't understand the exact purpose of Iteratoriter = set1.iterator();import java.util.*;public class Generic1 { public stati...


1 answers
93 views
0
The etherator for the door"

Usually, when outputting all values to the iterator, from forfor (iter=list.begin();iter!=list.end();iter++) cout<< *iter;I understand it's written as... But it comes out as soon as it is iter=l...

2 years ago

1 answers
83 views
0
Python Interlator Questions

class MultipleIterator: def __init__(self, stop, divisor): self.current = 0 self.stop = stop self.divisor = divisor def __iter__(self): return self def __next__(self): self.current += 1 if self....

2 years ago

© 2024 OneMinuteCode. All rights reserved.