-
Hi all, Just wondering if there's sample code of a map of maps or map of sets anywhere, and how to address them? Basically let's say we have ...
How would one address the value "x.2.sensors.0" (=3)? Map 2, map "sensors", set first value? In general, how does one store and address multidimensional data? Anyone got some sample code I can look at? Thank you kindly! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The typical approach is using the
The example is a little bit confusing, because you're using sets like |
Beta Was this translation helpful? Give feedback.
-
Thanks, and I see what you're saying about sets, thank you - I'll rework it as lists :) My original code was all in C++ stuctures so I've got to get away from cyrly braces lol :) |
Beta Was this translation helpful? Give feedback.
The typical approach is using the
[]
operator if you know the data is there:The example is a little bit confusing, because you're using sets like
{0,0,0,0}
with many equal entries, so in reality such a set will only have one element (0
). Also, you cannot really index into a set using the[]
operator, maybe the example should use lists defined with[0,0,0,0]
instead of sets?