Skip to content

Commit

Permalink
Move PriorityQueue and heap functions out of Base
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Jan 1, 2017
1 parent de957a5 commit d3f11cb
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 588 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ This section lists changes that do not have deprecation warnings.

* `quadgk` has been moved from Base into a separate package. ([#19741])

* The `Collections` module has been removed, and all functions defined therein have been
moved to the `DataStructures` package. ([#19800])

Library improvements
--------------------

Expand Down
18 changes: 18 additions & 0 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,24 @@ function append!{T}(a::Array{T,1}, items::AbstractVector)
return a
end

append!(a::Vector, iter) = _append!(a, iteratorsize(iter), iter)

function _append!(a, ::HasLength, iter)
n = length(a)
resize!(a, n+length(iter))
@inbounds for (i,item) in zip(n+1:length(a), iter)
a[i] = item
end
a
end

function _append!(a, ::IteratorSize, iter)
for item in iter
push!(a, item)
end
a
end

"""
prepend!(a::Vector, items) -> collection
Expand Down
Loading

0 comments on commit d3f11cb

Please sign in to comment.