Up

Module Flat_array = Flat_array

Signature

type 'slots t

The type of a flat-tuple array. 'slots will look like ('a1, ..., 'an) Slots.tn, and the array holds flat tuples of type 'a1 * ... * 'an.

val sexp_of_t : ('slots -> Sexplib.Sexp.t) -> 'slots t -> Sexplib.Sexp.t
include Blit.S1 with type 'a t := 'a t
type 'a t
val blit : ('a t, 'a t) Blit_intf.blit
val blito : ('a t, 'a t) Blit_intf.blito
val unsafe_blit : ('a t, 'a t) Blit_intf.blit
val sub : ('a t, 'a t) Blit_intf.sub
val subo : ('a t, 'a t) Blit_intf.subo
include Invariant.S1 with type 'a t := 'a t
type 'a t
val invariant : 'a Invariant_intf.inv -> 'a t Invariant_intf.inv
val create : (('tuple, _) Slots.t as 'slots) -> len:int -> 'tuple -> 'slots t

create slots ~len init creates an array of flat tuples, whose slots are initialized to the slots of init, which is an ordinary OCaml tuple. create raises if len < 0.

val copy : 'slots t -> 'slots t

copy a returns a shallow copy of a, that is, a fresh array containing the same elements as a.

val length : _ t -> int

accessors

val slots : 'slots t -> 'slots
val get : (_, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a

These functions get and set individual slots of flat tuple i in array t.

It is required that 0 <= i < length t.

val unsafe_get : (_, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
val set : (_, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val unsafe_set : (_, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val set_to_init : _ t -> int -> unit

set_to_init t i sets flat tuple i to the init that was supplied to create.

val is_init : _ t -> int -> bool

is_init t i returns true iff flat tuple i's slots are identical to those of the init supplied to create.

val get_all_slots : ('tuple, _) Slots.t t -> int -> 'tuple

get_all_slots t i allocates a new ordinary OCaml tuple whose components are equal to the slots of the flat tuple at index i of t. This is esentially an allocation plus a blit from t to the newly allocated tuple.

set_all_slots t i tuple sets all slots of the flat tuple at index i of t to their corresponding components of tuple. This is essentially a blit from tuple to t.

It is required that 0 <= i < length t.

val set_all_slots : ('tuple, _) Slots.t t -> int -> 'tuple -> unit