Interface to enumerate over files
I’m trying to design a generic interface for enumerating over a list files. Each iteration will open a file, allow the consuming code to access the file to perform some task, and then close the file.
Interface to enumerate over files
I’m trying to design a generic interface for enumerating over a list files. Each iteration will open a file, allow the consuming code to access the file to perform some task, and then close the file.
Which languages have the best support for stackful coroutines? [closed]
Closed 9 years ago.
Library design: better to leave potentially destructive feature in with a warning, or cut it out completely?
I recently created a red-black tree in C# to better understand how it works. With it, I implemented an in-order enumerator, however I quickly realized that enumerating a tree can have destructive results.
Why is iterating through List more expensive than iterating through Array in .NET?
According to the answers in this post, List<T>
is backed by an Array. According to this article, list iteration is considerably slower than array iteration.
What do you call an iterator that returns the current, previous and next siblings of each node of a list? [closed]
Closed 9 years ago.
Combination of visitor and iterator pattern
While studying the visitor design pattern i found this phrase:
How to create a custom next() function?
In C++, I need a custom iterator that goes over an array, not all elements of which are marked as valid. Thus, the next() function must be a bit smarter than the one just doing ++iterator; I need it to check validity of the next element, skip it if not valid, and so forth till a valid element is found or encoutering the array end. Just wonder if there’s a more elegant way to do so, rather than checking all elements in a loop one by one. For example: