On Fri, Nov 22, 2013 at 12:42 AM, Patrick Walton <[email protected]> wrote: > > There is `move_iter`, but that only works for owned vectors. Perhaps what > you want is a kind of iterator that clones its values... > > Patrick
The issue with a `Clone` iterator is that it adds an extra method to every container, and still borrows the container anyway. I'm happy for now with `map(|x| *x)` or `map(clone)`. In the simple case, you can just put the dereference in the for loop (`for &x in xs.iter()`) or one of the method calls (`xs.iter().fold(0, |a, &b| a + b`). _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
