package ocaml-protoc

  1. Overview
  2. Docs
type 'a t = {
  1. mutable s : int;
  2. mutable i : int;
  3. mutable a : 'a array;
  4. mutable l : 'a array list;
}

t is a container optimized for fast repeated inserts.

It is made of a list of growing size array l as well as a current array a in which inserts are performed until a is full and appended to l.

The main growing logic is implemented in the add functions.

val make : 'a -> 'b t
val of_array_no_copy : 'a array -> 'b t
val add : 'a -> 'b t -> unit
val to_array : 'a t -> 'b array
val list_rev_iter : ('a -> unit) -> 'b list -> unit

list_rev_iter f l iterate over the list in reverse order

val iter : ('a -> 'b) -> 'c t -> unit
val iteri : (int -> 'a -> 'b) -> 'c t -> unit
val fold_left : ('a -> 'b -> 'c) -> 'd -> 'e t -> 'f
val length : 'a t -> int
val map_to_array : ('a -> 'b) -> 'c t -> 'd array
val map_to_list : ('a -> 'b) -> 'c t -> 'd list
val identity : 'a -> 'a
val to_list : 'a t -> 'b list
OCaml

Innovation. Community. Security.