Add an iter2 iterator to vec.
This commit is contained in:
parent
56c8d16326
commit
84a6b888c0
@ -307,6 +307,14 @@ fn reversed<@T>(v: &[T]) -> [T] {
|
||||
ret rs;
|
||||
}
|
||||
|
||||
// Iterate over a list with with the indexes
|
||||
iter iter2<@T>(v: &[T]) -> (uint, T) {
|
||||
let i = 0u;
|
||||
for x in v {
|
||||
put (i, x);
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
|
||||
mod unsafe {
|
||||
type ivec_repr =
|
||||
|
Loading…
Reference in New Issue
Block a user