bug Weak.Create(_).iter

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5033 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 2002-07-23 16:10:00 +00:00
parent 6f75d4f557
commit 794633663d
1 changed files with 9 additions and 1 deletions

View File

@ -116,7 +116,15 @@ module Make (H : Hashtbl.HashedType) : (S with type data = H.t) = struct
Array.fold_right (fold_bucket 0) t.table init Array.fold_right (fold_bucket 0) t.table init
;; ;;
let iter f t = fold (fun d () -> ()) t ();; let iter f t =
let rec iter_bucket i b =
if i >= length b then () else
match get b i with
| Some v -> f v; iter_bucket (i+1) b
| None -> iter_bucket (i+1) b
in
Array.iter (iter_bucket 0) t.table
;;
let count t = let count t =
let rec count_bucket i b accu = let rec count_bucket i b accu =