module Flat_array: Flat_array
module Slots:Tuple_type.Slots
module Slot:Tuple_type.Slot
type 'slots
t
'slots
will look like ('a1, ..., 'an) Slots.tn
,
and the array holds flat tuples of type 'a1 * ... * 'an
.include Blit.S1
include Invariant.S1
val create : ('tuple, 'a) Slots.t ->
len:int -> 'tuple -> ('tuple, 'a) Slots.t 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 : 'a t -> int
val slots : 'slots t -> 'slots
val get : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
i
in array t
.
It is required that 0 <= i < length t
.
val unsafe_get : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
val set : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val unsafe_set : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val set_to_init : 'a t -> int -> unit
set_to_init t i
sets flat tuple i
to the init
that was supplied to create
.val is_init : 'a 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, 'a) 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, 'a) Slots.t t -> int -> 'tuple -> unit
val sexp_of_t : ('slots -> Sexplib.Sexp.t) -> 'slots t -> Sexplib.Sexp.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
.copy a
returns a shallow copy of a
, that is, a fresh array containing the same
elements as a
.i
in array t
.
It is required that 0 <= i < length t
.
set_to_init t i
sets flat tuple i
to the init
that was supplied to create
.
is_init t i
returns true
iff flat tuple i
's slots are identical to those of
the init
supplied to create
.
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
.