Skip to content

Commit 2e465b8

Browse files
committed
Allow implicit conversion
1 parent 776587b commit 2e465b8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/heaps/binary_heap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mutable struct BinaryHeap{T, O <: Base.Ordering} <: AbstractHeap{T}
3838
new{T,O}(O(), Vector{T}())
3939
end
4040

41-
function BinaryHeap{T, O}(xs::AbstractVector{T}) where {T,O}
41+
function BinaryHeap{T, O}(xs) where {T,O}
4242
ordering = O()
4343
valtree = heapify(xs, ordering)
4444
new{T,O}(ordering, valtree)

test/test_binheap.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
@test true
2424
end
2525

26+
@testset "implicit conversion" begin
27+
BinaryHeap{Float64, Base.ForwardOrdering}(vs)
28+
BinaryMinHeap{Float64}(vs)
29+
BinaryMaxHeap{Float64}(vs)
30+
31+
@test true
32+
end
33+
2634
@testset "confirm heap" begin
2735
@test isheap([1, 2, 3, 4, 7, 9, 10, 14, 8, 16])
2836
@test isheap([16, 14, 10, 8, 7, 3, 9, 1, 4, 2], Base.Reverse)

0 commit comments

Comments
 (0)