replace more vector + (issue #2719)

This commit is contained in:
Eric Holk
2012-06-28 13:52:13 -07:00
parent 58a39d1ca3
commit 59221e9ac8
9 changed files with 106 additions and 66 deletions

View File

@@ -5,6 +5,7 @@ import ptr::addr_of;
import libc::size_t;
export append;
export append_one;
export init_op;
export is_empty;
export is_not_empty;
@@ -492,6 +493,13 @@ pure fn append<T: copy>(+lhs: [T]/~, rhs: [const T]/&) -> [T]/~ {
ret v;
}
#[inline(always)]
pure fn append_one<T>(+lhs: [T]/~, +x: T) -> [T]/~ {
let mut v <- lhs;
unchecked { push(v, x); }
v
}
#[inline(always)]
pure fn append_mut<T: copy>(lhs: [mut T]/&, rhs: [const T]/&) -> [mut T]/~ {
let mut v = [mut]/~;