CCVectorMutability is rw (read-write) or ro (read-only).
type 'a klist = unit -> [ `Nil | `Cons of 'a * 'a klist ]type 'a printer = Format.formatter -> 'a -> unitCreate a new vector, the value is used to enforce the type the new vector.
val return : 'a -> ('a, 'mut) tSingleton vector.
val make : int -> 'a -> ('a, 'mut) tmake n x makes a vector of size n, filled with x.
val init : int -> (int -> 'a) -> ('a, 'mut) tInit the vector with the given function and size.
Clear the content of the vector, and deallocate the underlying array, removing references to all the elements.
Hint to the vector that it should have at least the given capacity.
Hint to the vector that it should have at least the given capacity. Just a hint, will not be enforced if the vector is empty and init is not provided.
val is_empty : ('a, _) t -> boolIs the vector empty?
val top : ('a, _) t -> 'a optionTop element, if present.
val top_exn : ('a, _) t -> 'aTop element, if present.
Shrink to the given size (remove elements above this size). Does nothing if the parameter is bigger than the current size.
val shrink_to_fit : ('a, _) t -> unitShrink internal array to fit the size of the vector
val member : eq:('a -> 'a -> bool) -> 'a -> ('a, _) t -> boolIs the element a member of the vector?
Sort the vector, returning a copy of it that is sorted w.r.t the given ordering. The vector itself is unchanged. The underlying array of the new vector can be smaller than the original one.
Sort the vector in place (modifying it). This function change the size of the underlying array.
Sort the array and remove duplicates, in place (e.g. modifying the vector itself).
val iter : ('a -> unit) -> ('a, _) t -> unitIterate on the vector's content.
val iteri : (int -> 'a -> unit) -> ('a, _) t -> unitIterate on the vector, with indexes.
map f v is just like map, but it also passes in the index of each element as the first argument to the function f.
val map_in_place : ('a -> 'a) -> ('a, _) t -> unitMap elements of the vector in place
Filter elements from the vector. filter p v leaves v unchanged but returns a new vector that only contains elements of v satisfying p.
val fold : ('b -> 'a -> 'b) -> 'b -> ('a, _) t -> 'bFold on elements of the vector
val exists : ('a -> bool) -> ('a, _) t -> boolExistential test (is there an element that satisfies the predicate?).
val for_all : ('a -> bool) -> ('a, _) t -> boolUniversal test (do all the elements satisfy the predicate?).
val find : ('a -> bool) -> ('a, _) t -> 'a optionFind an element that satisfies the predicate.
val find_exn : ('a -> bool) -> ('a, _) t -> 'aFind an element that satisfies the predicate, or
val find_map : ('a -> 'b option) -> ('a, _) t -> 'b optionfind_map f v returns the first Some y = f x for x in v, or None if f x = None for each x in v.
Map elements with a function, possibly filtering some of them out.
val filter_map_in_place : ('a -> 'a option) -> ('a, _) t -> unitFilter-map elements of the vector in place
Like flat_map, but using Seq for intermediate collections.
Like flat_map, but using list for intermediate collections.
All combinaisons of tuples from the two vectors are passed to the function.
val get : ('a, _) t -> int -> 'aAccess element by its index, or
Remove the n-th element of the vector. Does NOT preserve the order of the elements (might swap with the last element).
val rev_iter : ('a -> unit) -> ('a, _) t -> unitrev_iter f a is the same as iter f (rev a), only more efficient.
val size : ('a, _) t -> intNumber of elements in the vector.
val capacity : (_, _) t -> intNumber of elements the vector can contain without being resized.
Access the underlying shared array (do not modify!). unsafe_get_array v is longer than size v, but elements at higher index than size v are undefined (do not access!).
val (--) : int -> int -> (int, 'mut) tRange of integers, either ascending or descending (both included, therefore the result is never empty). Example: 1 -- 10 returns the vector [1;2;3;4;5;6;7;8;9;10].
val (--^) : int -> int -> (int, 'mut) tRange of integers, either ascending or descending, but excluding right. Example: 1 --^ 10 returns the vector [1;2;3;4;5;6;7;8;9].
val of_array : 'a array -> ('a, 'mut) tof_array a returns a vector corresponding to the array a. Operates in O(n) time.
val of_list : 'a list -> ('a, 'mut) tval to_array : ('a, _) t -> 'a arrayto_array v returns an array corresponding to the vector v.
val to_list : ('a, _) t -> 'a listReturn a list with the elements contained in the vector.
to_iter_rev v returns the sequence of elements of v in reverse order, that is, the last elements of v are iterated on first.
to_seq v returns the sequence of elements of v in reverse order, that is, the last elements of v are iterated on first.
Vector as an array slice. By doing it we expose the internal array, so be careful!.
slice_seq v start len is the sequence of elements from v.(start) to v.(start+len-1).
val fill_empty_slots_with : ('a, _) t -> 'a -> unitval to_string :
?start:string ->
?stop:string ->
?sep:string ->
('a -> string) ->
('a, _) t ->
stringPrint the vector in a string
Let operators on OCaml >= 4.08.0, nothing otherwise