Add an iter2 iterator to vec.
This commit is contained in:
parent
56c8d16326
commit
84a6b888c0
1 changed files with 8 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue