Skip to content

Commit 15dd2b7

Browse files
xlxs4lazarusA
authored andcommitted
Document copy! for vector types (JuliaLang#54142) (JuliaLang#54392)
Fixes JuliaLang#54142. Also documents the `firstindex(dst) == firstindex(src)` check, since the `axes(dst) == axes(src)` is already documented.
1 parent 657a486 commit 15dd2b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

base/abstractarray.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,13 +896,18 @@ emptymutable(itr, ::Type{U}) where {U} = Vector{U}()
896896
In-place [`copy`](@ref) of `src` into `dst`, discarding any pre-existing
897897
elements in `dst`.
898898
If `dst` and `src` are of the same type, `dst == src` should hold after
899-
the call. If `dst` and `src` are multidimensional arrays, they must have
899+
the call. If `dst` and `src` are vector types, they must have equal
900+
offset. If `dst` and `src` are multidimensional arrays, they must have
900901
equal [`axes`](@ref).
901902
902903
$(_DOCS_ALIASING_WARNING)
903904
904905
See also [`copyto!`](@ref).
905906
907+
!!! note
908+
When operating on vector types, if `dst` and `src` are not of the
909+
same length, `dst` is resized to `length(src)` prior to the `copy`.
910+
906911
!!! compat "Julia 1.1"
907912
This method requires at least Julia 1.1. In Julia 1.0 this method
908913
is available from the `Future` standard library as `Future.copy!`.

0 commit comments

Comments
 (0)