Type instabilities when dealing with structs and Ref

Perhaps a nicer approach:

julia> struct S{T<:Ref{<:Integer}}
           a::T
       end

julia> f(x) = S(Ref(x))
f (generic function with 1 method)

julia> f(42)
S{Base.RefValue{Int64}}(Base.RefValue{Int64}(42))
3 Likes