core: Improve the docs and signature of vec::iter2
This commit is contained in:
parent
d6ded6788d
commit
b1eb4579c6
@ -773,11 +773,19 @@ fn iter_between<T>(v: [const T], start: uint, end: uint, f: fn(T)) {
|
||||
}
|
||||
}
|
||||
|
||||
#[doc = "Iterates over two vectors in parallel"]
|
||||
#[doc = "
|
||||
Iterates over two vectors simultaneously
|
||||
|
||||
# Failure
|
||||
|
||||
Both vectors must have the same length
|
||||
"]
|
||||
#[inline]
|
||||
fn iter2<U, T>(v: [ U], v2: [const T], f: fn(U, T)) {
|
||||
let mut i = 0;
|
||||
for elt in v { f(elt, v2[i]); i += 1; }
|
||||
fn iter2<U, T>(v1: [const U], v2: [const T], f: fn(U, T)) {
|
||||
assert len(v1) == len(v2);
|
||||
uint::range(0u, len(v1)) {|i|
|
||||
f(v1[i], v2[i])
|
||||
}
|
||||
}
|
||||
|
||||
#[doc = "
|
||||
|
Loading…
x
Reference in New Issue
Block a user