Base.Option_array'a Option_array.t is a compact representation of 'a option array: it avoids allocating heap objects representing Some x, usually representing them with x instead. It uses a special representation for None that's guaranteed to never collide with any representation of Some x.
include Sexpable.S1 with type 'a t := 'a tval t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a tval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.tval empty : _ tval create : len:int -> _ tInitially filled with all None
val init_some : int -> f:(int -> 'a) -> 'a tval init : int -> f:(int -> 'a option) -> 'a tval length : _ t -> intval get : 'a t -> int -> 'a optionget t i returns the element number i of array t, raising if i is outside the range 0 to length t - 1.
val get_some_exn : 'a t -> int -> 'aRaises if the element number i is None.
val is_none : _ t -> int -> boolis_none t i = Option.is_none (get t i)
val is_some : _ t -> int -> boolis_some t i = Option.is_some (get t i)
These can cause arbitrary behavior when used for an out-of-bounds array access.
val unsafe_get : 'a t -> int -> 'a optionval unsafe_get_some_exn : 'a t -> int -> 'aunsafe_get_some_exn t i is unsafe because it does not bounds check i. It does, however check whether the value at index i is none or some, and raises if it is none.
val unsafe_get_some_assuming_some : 'a t -> int -> 'aunsafe_get_some_assuming_some t i is unsafe both because it does not bounds check i and because it does not check whether the value at index i is none or some, assuming that it is some.
val unsafe_is_some : _ t -> int -> boolval set : 'a t -> int -> 'a option -> unitset t i x modifies array t in place, replacing element number i with x, raising if i is outside the range 0 to length t - 1.
val set_some : 'a t -> int -> 'a -> unitval set_none : _ t -> int -> unitval swap : _ t -> int -> int -> unitval clear : _ t -> unitReplaces all the elements of the array with None.
Unsafe versions of set*. Can cause arbitrary behaviour when used for an out-of-bounds array access.
val unsafe_set : 'a t -> int -> 'a option -> unitval unsafe_set_some : 'a t -> int -> 'a -> unitval unsafe_set_none : _ t -> int -> unit