mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
Fix CCVector.append_array (empty vector case)
This commit is contained in:
parent
f1942fd0d4
commit
9219d24356
1 changed files with 9 additions and 3 deletions
|
|
@ -205,9 +205,15 @@ let append_seq a seq =
|
|||
|
||||
let append_array a b =
|
||||
let len_b = Array.length b in
|
||||
ensure a (a.size + len_b);
|
||||
Array.blit b 0 a.vec a.size len_b;
|
||||
a.size <- a.size + len_b
|
||||
if _empty_array a then (
|
||||
a.vec <- Array.copy b;
|
||||
a.size <- len_b;
|
||||
)
|
||||
else (
|
||||
ensure a (a.size + len_b);
|
||||
Array.blit b 0 a.vec a.size len_b;
|
||||
a.size <- a.size + len_b
|
||||
)
|
||||
|
||||
(*$T
|
||||
let v1 = init 5 (fun i->i) and v2 = Array.init 5 (fun i->i+5) in \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue