mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
wip(3.0): rename CCVector.remove to CCVector.remove_unordered
This commit is contained in:
parent
0f9e51fbe3
commit
c1461940c2
2 changed files with 4 additions and 4 deletions
|
|
@ -247,8 +247,8 @@ let set v i x =
|
||||||
if i < 0 || i >= v.size then invalid_arg "CCVector.set";
|
if i < 0 || i >= v.size then invalid_arg "CCVector.set";
|
||||||
Array.unsafe_set v.vec i x
|
Array.unsafe_set v.vec i x
|
||||||
|
|
||||||
let remove v i =
|
let remove_unordered v i =
|
||||||
if i < 0 || i >= v.size then invalid_arg "CCVector.remove";
|
if i < 0 || i >= v.size then invalid_arg "CCVector.remove_unordered";
|
||||||
(* if v.(i) not the last element, then put last element at index i *)
|
(* if v.(i) not the last element, then put last element at index i *)
|
||||||
if i < v.size - 1
|
if i < v.size - 1
|
||||||
then v.vec.(i) <- v.vec.(v.size - 1);
|
then v.vec.(i) <- v.vec.(v.size - 1);
|
||||||
|
|
@ -547,7 +547,7 @@ let iteri k v =
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
let v = (0--6) in \
|
let v = (0--6) in \
|
||||||
iteri (fun i x -> if i = 3 then remove v i) v; length v = 6
|
iteri (fun i x -> if i = 3 then remove_unordered v i) v; length v = 6
|
||||||
*)
|
*)
|
||||||
|
|
||||||
let map f v =
|
let map f v =
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ val set : ('a, rw) t -> int -> 'a -> unit
|
||||||
(** Modify element at given index, or
|
(** Modify element at given index, or
|
||||||
@raise Invalid_argument if bad index. *)
|
@raise Invalid_argument if bad index. *)
|
||||||
|
|
||||||
val remove : ('a, rw) t -> int -> unit
|
val remove_unordered : ('a, rw) t -> int -> unit
|
||||||
(** Remove the [n-th] element of the vector. Does {b NOT} preserve the order
|
(** Remove the [n-th] element of the vector. Does {b NOT} preserve the order
|
||||||
of the elements (might swap with the last element). *)
|
of the elements (might swap with the last element). *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue