Stl invalidating iterators Bi roulette chat
There are subtle differences and distinctions in the use of the terms "generator" and "iterator", which vary between authors and languages.
Some object-oriented languages such as C#, C (later versions), Delphi (later versions), Go, Java (later versions), Lua, Perl, Python, Ruby provide an intrinsic way of iterating through the elements of a container object without the introduction of an explicit iterator object.
This article describes the pattern I prefer to write such a loop in the correct way.If there can be exceptions to this statement, please let me know! This effectively reduces the container size by the number of elements removed, which are destroyed.A loop counter, however, only provides the traversal functionality and not the element access functionality.One way of implementing iterators is to use a restricted form of coroutine, known as a generator.
Can I iterate through the set, deleting certain ones, without invalidating the iterator?