Something like this?
julia> struct Pq{T1,T2}
t::Vector{T1}
data::Vector{T2}
Pq(T1,T2) = new{T1,T2}(T1[],T2[])
end
julia> function push_pq!(pq::Pq,t,data)
push!(pq.t,t)
push!(pq.data,data)
return pq
end
push_pq! (generic function with 1 method)
julia> pop_pq!(pq::Pq) = (pq.t,pq.data)
pop_pq! (generic function with 1 method)
julia> pq1 = Pq(Float64,Any)
Pq{Float64, Any}(Float64[], Any[])
julia> pq1 = Pq(Float64,Any)
Pq{Float64, Any}(Float64[], Any[])
julia> push_pq!(pq1,1.1,2.3)
Pq{Float64, Any}([1.1], Any[2.3])
julia> push_pq!(pq1,1.2,"toto")
Pq{Float64, Any}([1.1, 1.2], Any[2.3, "toto"])
julia> t, data = pop_pq!(pq1)
([1.1, 1.2], Any[2.3, "toto"])
julia> t
2-element Vector{Float64}:
1.1
1.2
julia> data
2-element Vector{Any}:
2.3
"toto"
(this is not a “callable struct”, but it could be, but that is something else).
disclaimer: I just followed the initial “target” behavior, the actual code was too complicated
. If this is not what you were asking, I’m sorry.