Skip to content

Commit d58dda0

Browse files
authored
Implement append! (#138)
1 parent ea4008f commit d58dda0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/OffsetArrays.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ Base.show(io::IO, ::MIME"text/plain", r::OffsetRange) = show(io, r)
235235
Base.resize!(A::OffsetVector, nl::Integer) = (resize!(A.parent, nl); A)
236236
Base.push!(A::OffsetVector, x...) = (push!(A.parent, x...); A)
237237
Base.pop!(A::OffsetVector) = pop!(A.parent)
238+
Base.append!(A::OffsetVector, items) = (append!(A.parent, items); A)
238239
Base.empty!(A::OffsetVector) = (empty!(A.parent); A)
239240

240241
### Low-level utilities ###

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,10 @@ end
827827
o = OffsetVector([1, 2, 3], -1)
828828
@test pop!(o) == 3
829829
@test axes(o, 1) == 0:1
830+
# append!
831+
o = OffsetVector([1, 2, 3], -1)
832+
append!(o, [4, 5])
833+
@test axes(o, 1) == 0:4
830834
# empty!
831835
o = OffsetVector([1, 2, 3], -1)
832836
@test empty!(o) === o

0 commit comments

Comments
 (0)