Module Base__Obj_array
This module is not exposed for external use, and is only here for the implementation of Uniform_array
internally. Obj.t Uniform_array.t
should be used in place of Obj_array.t
.
val sexp_of_t : t -> Base.Sexp.t
include Base.Blit.S with type t := t
val subo : ?pos:int -> ?len:int -> t -> t
val sub : t -> pos:int -> len:int -> t
val unsafe_blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit
val blito : src:t -> ?src_pos:int -> ?src_len:int -> dst:t -> ?dst_pos:int -> unit -> unit
val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit
include Base.Invariant.S with type t := t
val invariant : t -> unit
val create : len:int -> Caml.Obj.t -> t
create ~len x
returns an obj-array of lengthlen
, all of whose indices have valuex
.
val create_zero : len:int -> t
create_zero ~len
returns an obj-array of lengthlen
, all of whose indices have valueCaml.Obj.repr 0
.
val singleton : Caml.Obj.t -> t
val empty : t
val length : t -> int
val get : t -> int -> Caml.Obj.t
get t i
andunsafe_get t i
return the object at indexi
.set t i o
andunsafe_set t i o
set indexi
too
. In no case is the object copied. Theunsafe_*
variants omit the bounds check ofi
.
val unsafe_get : t -> int -> Caml.Obj.t
val set : t -> int -> Caml.Obj.t -> unit
val unsafe_set : t -> int -> Caml.Obj.t -> unit
val swap : t -> int -> int -> unit
val unsafe_set_assuming_currently_int : t -> int -> Caml.Obj.t -> unit
unsafe_set_assuming_currently_int t i obj
sets indexi
oft
toobj
, but only works correctly ifCaml.Obj.is_int (get t i)
. This precondition saves a dynamic check.unsafe_set_int_assuming_currently_int
is similar, except the value being set is an int.unsafe_set_int
is similar but does not assume anything about the target.
val unsafe_set_int_assuming_currently_int : t -> int -> int -> unit
val unsafe_set_int : t -> int -> int -> unit
val unsafe_set_omit_phys_equal_check : t -> int -> Caml.Obj.t -> unit
unsafe_set_omit_phys_equal_check
is likeunsafe_set
, except it doesn't do aphys_equal
check to try to skipcaml_modify
. It is safe to call this even if the values arephys_equal
.
val unsafe_clear_if_pointer : t -> int -> unit
unsafe_clear_if_pointer t i
preventst.(i)
from pointing to anything to prevent space leaks. It does this by settingt.(i)
toCaml.Obj.repr 0
. As a performance hack, it only does this whennot (Caml.Obj.is_int t.(i))
.
val truncate : t -> len:int -> unit
truncate t ~len
shortenst
's length tolen
. It is an error iflen <= 0
orlen > length t
.