module type DEFAULT = sig
.. end
type
key
type 'a
t
A hashtable for keys of type key
and values of type 'a
val create : ?size:int -> 'a -> 'a t
create d
makes a new table that maps every key to d
by default.
size
: optional size of the initial table
val create_with : ?size:int -> (key -> 'a) -> 'a t
Similar to create d
but here d
is a function called to obtain a
new default value for each distinct key. Useful if the default
value is stateful.
val get : 'a t -> key -> 'a
Unfailing retrieval (possibly returns the default value). This will
modify the table if the key wasn't present.
val set : 'a t -> key -> 'a -> unit
Replace the current binding for this key
val remove : 'a t -> key -> unit
Remove the binding for this key. If get tbl k
is called later, the
default value for the table will be returned
val to_seq : 'a t -> (key * 'a) CCHashtbl.sequence
Pairs of (elem, value)
for all elements on which get
was called