aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_vec.rs
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-06-28 23:18:51 -0700
committerRoy Frostig <[email protected]>2010-06-28 23:18:51 -0700
commit023e5af6398f8892fee429759096ba8c2480ed7d (patch)
tree732480750073263707d6ce2cc43e562a7546dcf1 /src/lib/_vec.rs
parentAdd a NO_VALGRIND override mechanism to makefile, if you want day-to-day buil... (diff)
downloadrust-023e5af6398f8892fee429759096ba8c2480ed7d.tar.xz
rust-023e5af6398f8892fee429759096ba8c2480ed7d.zip
The few and proud isolated bits from stdlib-work so far that don't break everything. Note util.rs hasn't yet been declared mod in the std crate. Don't do that yet, as it breaks make check.
Diffstat (limited to 'src/lib/_vec.rs')
-rw-r--r--src/lib/_vec.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
index c938e6fb..86733fb5 100644
--- a/src/lib/_vec.rs
+++ b/src/lib/_vec.rs
@@ -28,3 +28,14 @@ fn len[T](vec[T] v) -> uint {
fn buf[T](vec[T] v) -> vbuf {
ret rustrt.vec_buf[T](v);
}
+
+// Ought to take mutable &vec[T] v and just mutate it instead of copy
+// and return. Blocking on issue #89 for this.
+fn grow[T](mutable vec[T] v, int n, T initval) -> vec[T] {
+ let int i = n;
+ while (i > 0) {
+ i -= 1;
+ v += vec(initval);
+ }
+ ret v;
+}