aboutsummaryrefslogtreecommitdiff
path: root/clib/hMap.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2018-12-19 16:23:27 +0100
committerPierre-Marie Pédrot2018-12-19 16:23:27 +0100
commit116f255bb51a8186a1986e5147c09a7129692af9 (patch)
tree190fdfe7d60e243ce54f41629e41a652cfdbd8e0 /clib/hMap.ml
parent41400286140d8808412b697642d92df063cb3464 (diff)
parent5421b17f22b09ecca688a989a268385005dad01b (diff)
Merge PR #9237: Add Map.find_opt
Diffstat (limited to 'clib/hMap.ml')
-rw-r--r--clib/hMap.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/clib/hMap.ml b/clib/hMap.ml
index 9c80398e4d..5d634b7af0 100644
--- a/clib/hMap.ml
+++ b/clib/hMap.ml
@@ -353,6 +353,12 @@ struct
let m = Int.Map.find h s in
Map.find k m
+ let find_opt k s =
+ let h = M.hash k in
+ match Int.Map.find_opt h s with
+ | None -> None
+ | Some m -> Map.find_opt k m
+
let get k s = try find k s with Not_found -> assert false
let split k s = assert false (** Cannot be implemented efficiently *)