On 12/10/12 2:34 PM, Peter Ronnquist wrote:
Hi,I am having problems with adding an element to a '@' vector in rust 0.4. The following works fine with a "~" vector but not with a '@' vector: let mut objects_1 : &mut ~[Object] = &mut ~[]; let mut objects_2 : &mut @[Object] = &mut @[]; objects_1.push(Bat_(bat)); objects_2.push(Bat_(bat)); // Line 124
Appending to an `@` vector would require copying the entire vector, just as with arrays in Java. (We should still probably support `push` on it with this performance caveat, but that's the reason why we don't right now.)
If you want to append to a vector, you probably want the `DVec` type, or a ~vector.
Patrick _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
