Dolmen_std.VecResieable arrays
This is a minimalistic implementation of resizeable arrays.
val make : int -> 'a -> 'a tmake cap dummy creates a new vector filled with dummy. The vector is initially empty but its underlying array has capacity cap. dummy will stay alive as long as the vector
val create : unit -> 'a tCreate a fresh vector.
val size : 'a t -> intSize of the vector, aka number of elements in the vector.
val is_empty : 'a t -> boolIs the vector empty ?
val is_full : 'a t -> boolIs the capacity of the vector equal to the number of its elements?
val clear : 'a t -> unitSet size to 0, doesn't free elements
val shrink : 'a t -> int -> unitshrink vec sz resets size of vec to sz. Assumes sz >=0 && sz <= size vec
Get/Set operations
val get : 'a t -> int -> 'aget the element at the given index, or
val last : 'a t -> 'aget the last element, or
val set : 'a t -> int -> 'a -> unitset the element at the given index, either already set or the first free slot if not (is_full vec), or
val push : 'a t -> 'a -> unitPush element into the vector
val pop : 'a t -> 'aPop last element and return it.