diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-27 17:06:49 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-27 17:06:49 -0700 |
| commit | 74a1e054eb8d63d30acae7dab6c28e81a1be303a (patch) | |
| tree | fe6272adb0211b869794a22634c2995d5c3a8171 /src | |
| parent | 506ae934f808c2cf664f289dc29f7e90d253a454 (diff) | |
| download | rust-74a1e054eb8d63d30acae7dab6c28e81a1be303a.tar.gz rust-74a1e054eb8d63d30acae7dab6c28e81a1be303a.zip | |
Make std:vec::grow_fn take an init_op type
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/vec.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/vec.rs b/src/lib/vec.rs index fd6e594e1ad..76ce8eeac25 100644 --- a/src/lib/vec.rs +++ b/src/lib/vec.rs @@ -337,10 +337,10 @@ v - The vector to grow n - The number of elements to add init_fn - A function to call to retreive each appended element's value */ -fn grow_fn<T>(&v: [T], n: uint, init_fn: block(uint) -> T) { +fn grow_fn<T>(&v: [T], n: uint, op: init_op<T>) { reserve(v, next_power_of_two(len(v) + n)); let i: uint = 0u; - while i < n { v += [init_fn(i)]; i += 1u; } + while i < n { v += [op(i)]; i += 1u; } } /* |
