Module 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 t
val t_of_sexp : (Sexplib0.Sexp.t -> 'a) -> Sexplib0.Sexp.t -> 'a tval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
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 ireturns the element numberiof arrayt, raising ifiis outside the range 0 tolength t - 1.
val get_some_exn : 'a t -> int -> 'aRaises if the element number
iisNone.
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)
val unsafe_get : 'a t -> int -> 'a optionval unsafe_get_some_exn : 'a t -> int -> 'aunsafe_get_some_exn t iis unsafe because it does not bounds checki. It does, however check whether the value at indexiis none or some, and raises if it is none.
val unsafe_get_some_assuming_some : 'a t -> int -> 'aunsafe_get_some_assuming_some t iis unsafe both because it does not bounds checkiand because it does not check whether the value at indexiis none or some, assuming that it is some.
val unsafe_is_some : _ t -> int -> boolval set : 'a t -> int -> 'a option -> unitset t i xmodifies arraytin place, replacing element numberiwithx, raising ifiis outside the range 0 tolength 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.
val unsafe_set : 'a t -> int -> 'a option -> unitval unsafe_set_some : 'a t -> int -> 'a -> unitval unsafe_set_none : _ t -> int -> unit
include Blit.S1 with type 'a t := 'a t
val blit : ('a t, 'a t) Base__.Blit_intf.blitval blito : ('a t, 'a t) Base__.Blit_intf.blitoval unsafe_blit : ('a t, 'a t) Base__.Blit_intf.blitval sub : ('a t, 'a t) Base__.Blit_intf.subval subo : ('a t, 'a t) Base__.Blit_intf.subo