Skip to content

Commit 84a6b88

Browse files
committed
Add an iter2 iterator to vec.
1 parent 56c8d16 commit 84a6b88

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib/vec.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ fn reversed<@T>(v: &[T]) -> [T] {
307307
ret rs;
308308
}
309309

310+
// Iterate over a list with with the indexes
311+
iter iter2<@T>(v: &[T]) -> (uint, T) {
312+
let i = 0u;
313+
for x in v {
314+
put (i, x);
315+
i += 1u;
316+
}
317+
}
310318

311319
mod unsafe {
312320
type ivec_repr =

0 commit comments

Comments
 (0)