package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Unsafe functions provide faster alternatives to regular functions with the same name. They don't allocate but the behavior is unspecified and could be memory unsafe in certain cases where regular functions would fail with informative exceptions.

module Elt : sig ... end
val add_removable : 'a Heap.t -> 'a -> 'a Elt.t

add_removable t v returns a token that can be later used to remove v. Unlike the regular function, this unsafe version doesn't allocate.

val remove : 'a Heap.t -> 'a Elt.t -> Base.Unit.t

remove t elt removes elt from t. Behavior is undefined and could lead to segfaults if t and elt don't match, if elt was already removed, or if the underlying value has already been removed (e.g., via pop).

val update : 'a Heap.t -> 'a Elt.t -> 'a -> 'a Elt.t

update t token v is shorthand for remove t token; add_removable t v.

OCaml

Innovation. Community. Security.