== Quote from Michel Fortin ([email protected])'s article > Question: if the container's memory isn't garbage-collected, how do you > implement iterators, eh, ranges so that they are still memory-safe?
The way I'm picturing this being implemented is that a GC'd class instance exists at the top level, and then the internal implementation-detail storage that the class uses is implemented via malloc and free. This storage would get freed in the class finalizer when the instance is GC'd. In this case all you'd need to do is make the range hold a reference to the class instance so it wouldn't be GC'd.
