While trying to understand parametric structs in Julia, I defined following struct as a subtype of AbstractSet
struct MySet{T} <: AbstractSet{T}
st::Vector{T}
MySet(x::Vector{T}) where {T} = new{T}(x)
end
However, I get following error when I try to create a new object of type MySet
julia> MySet([1,2])
MethodError: no method matching iterate(::MySet{Int64})
Closest candidates are:
iterate(::Union{LinRange, StepRangeLen}) at ~/julia-1.7.1-linux-x86_64/julia-
1.7.1/share/julia/base/range.jl:826
iterate(::Union{LinRange, StepRangeLen}, ::Integer) at ~/julia-1.7.1-linux-
x86_64/julia-1.7.1/share/julia/base/range.jl:826
iterate(::T) where T<:Union{Base.KeySet{<:Any, <:Dict},
Base.ValueIterator{<:Dict}} at ~/julia-1.7.1-linux-x86_64/julia-
1.7.1/share/julia/base/dict.jl:695
Can someone help me understand why I am getting this error.