From 74a1e054eb8d63d30acae7dab6c28e81a1be303a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 27 Oct 2011 17:06:49 -0700 Subject: [PATCH] Make std:vec::grow_fn take an init_op type --- src/lib/vec.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/vec.rs b/src/lib/vec.rs index fd6e594e1ad0..76ce8eeac257 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(&v: [T], n: uint, init_fn: block(uint) -> T) { +fn grow_fn(&v: [T], n: uint, op: init_op) { 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; } } /*