core: Make vec::push faster
This way makes it equivalent to the compiler's vec push, and is a lot faster than calling vec::grow.
This commit is contained in:
parent
affd83ea0e
commit
3411d19369
|
@ -409,13 +409,14 @@ fn pop<T>(&v: [const T]) -> T unsafe {
|
|||
val
|
||||
}
|
||||
|
||||
#[inline]
|
||||
/*
|
||||
Function: push
|
||||
|
||||
Append an element to a vector and return it
|
||||
Append an element to a vector
|
||||
*/
|
||||
fn push<T: copy>(&v: [T], initval: T) {
|
||||
grow(v, 1u, initval)
|
||||
v += [initval];
|
||||
}
|
||||
|
||||
// TODO: More.
|
||||
|
|
Loading…
Reference in New Issue