diff --git a/src/heaps/minmax_heap.jl b/src/heaps/minmax_heap.jl index 5009c1aec..bc59107ab 100644 --- a/src/heaps/minmax_heap.jl +++ b/src/heaps/minmax_heap.jl @@ -9,12 +9,14 @@ mutable struct BinaryMinMaxHeap{T} <: AbstractMinMaxHeap{T} BinaryMinMaxHeap{T}() where {T} = new{T}(Vector{T}()) - function BinaryMinMaxHeap(xs::AbstractVector{T}) where {T} + function BinaryMinMaxHeap{T}(xs::AbstractVector{T}) where {T} valtree = _make_binary_minmax_heap(xs) new{T}(valtree) end end +BinaryMinMaxHeap(xs::AbstractVector{T}) where T = BinaryMinMaxHeap{T}(xs) + ################################################ # # core implementation diff --git a/test/test_minmax_heap.jl b/test/test_minmax_heap.jl index c57261bfa..045286e20 100644 --- a/test/test_minmax_heap.jl +++ b/test/test_minmax_heap.jl @@ -8,7 +8,7 @@ using Base.Order: Forward, Reverse vs = [10, 4, 6, 1, 16, 2, 20, 17, 13, 5] BinaryMinMaxHeap{Int}() - + BinaryMinMaxHeap{Int}(vs) BinaryMinMaxHeap(vs) @test true