Add std::ivec::to_mut, from_mut
This commit is contained in:
parent
8c4f1652ec
commit
f010f79a61
1 changed files with 16 additions and 0 deletions
|
|
@ -72,6 +72,22 @@ fn init_elt_mut[T](&T t, uint n_elts) -> T[mutable] {
|
|||
ret v;
|
||||
}
|
||||
|
||||
fn to_mut[T](&T[] v) -> T[mutable] {
|
||||
auto vres = ~[mutable];
|
||||
for (T t in v) {
|
||||
vres += ~[mutable t];
|
||||
}
|
||||
ret vres;
|
||||
}
|
||||
|
||||
fn from_mut[T](&T[mutable] v) -> T[] {
|
||||
auto vres = ~[];
|
||||
for (T t in v) {
|
||||
vres += ~[t];
|
||||
}
|
||||
ret vres;
|
||||
}
|
||||
|
||||
// Predicates
|
||||
pred is_empty[T](&T[mutable?] v) -> bool {
|
||||
// FIXME: This would be easier if we could just call len
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue