core: Improve the docs and signature of vec::iter2

This commit is contained in:
Brian Anderson 2012-03-18 15:41:03 -07:00
parent d6ded6788d
commit b1eb4579c6

View File

@ -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 = "