mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
add mem to CCHashTrie
This commit is contained in:
parent
791eb8efba
commit
47414c7f40
2 changed files with 12 additions and 4 deletions
|
|
@ -38,6 +38,8 @@ module type S = sig
|
|||
|
||||
val add : key -> 'a -> 'a t -> 'a t
|
||||
|
||||
val mem : key -> _ t -> bool
|
||||
|
||||
val get : key -> 'a t -> 'a option
|
||||
|
||||
val get_exn : key -> 'a t -> 'a
|
||||
|
|
@ -317,6 +319,10 @@ module Make(Key : KEY)
|
|||
try Some (get_exn_ k ~h:(hash_ k) m)
|
||||
with Not_found -> None
|
||||
|
||||
let mem k m =
|
||||
try ignore (get_exn_ k ~h:(hash_ k) m); true
|
||||
with Not_found -> false
|
||||
|
||||
(* TODO: use Hash.combine if array only has one non-empty LEAF element? *)
|
||||
|
||||
(* [left] list nodes already visited *)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ module type S = sig
|
|||
|
||||
val add : key -> 'a -> 'a t -> 'a t
|
||||
|
||||
val mem : key -> _ t -> bool
|
||||
|
||||
val get : key -> 'a t -> 'a option
|
||||
|
||||
val get_exn : key -> 'a t -> 'a
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue