On Thu, Jun 06, 2013 at 12:09:29AM -0400, Daniel Micay wrote: > A quick terminology refresher, for those who aren't familiar with it: > Another issue is mutability, as you can write iterators that are able to > mutate > containers. With internal iterators, this is easy to do with safe code. With > external ones, it will `unsafe` and won't be easy to get right.
Something about this assertion didn't sit right with me. It took me a little bit, but I realized it's actually faily easy to do a mutable external iterator. Here is an example for a binary tree, visiting in pre-order. https://gist.github.com/nikomatsakis/5736715 Perhaps there are other cases that are harder? I'd be curious to know how the efficiency of this compares with the internal iterator case; clearly, it requires allocation where an internal iterator does not. Niko _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
