Hi all,
I would like to use a Dict (or a similar structure) with values that can have different, but concrete types for given keys. For example:
mydict = Dict(:a=> 2, :b=>[1.0, 3.0], :c=> "hello type")
In general, this means typeof(mydict)
is Dict{Symbol, Any}
, so entries of mydict
are type Any
. However, I want to use mydict
in a way, that the type of key :a
is always Int
, the type of key :b
is always Vector{Float64}
and so on.
Is there a way to set a specific type of the entries for the keys :a
, :b
and :c
? Or could one implement a custom “Dict” that can do so?
I hope I made my question clear. I’m happy for answers!
Best