What kind of list should I use to add struct instances
Example struct:
DynamicVector cannot contain this struct instance because it is no register storable. What other type of list should I use? What would be a sample code for that?
3 Replies
There isn't currently any list type that supports non-register-passable structs,
Pointer
s to non-register-passable structs cannot be .load()
-ed. However, if you wanna try slapping @register_passable("trivial")
on anything, go ahead! I can't test anything right now, but I think this Item struct could be since I just learned that StringLiteral is register passable or equivalent. Beware, though. There are a multitude of lifetime issues associated with dealing with this. Make sure you know where you're making a shallow copy of a struct and where you want to actually copy the pointed-to-memory with memcpy or similar.Thanks for the reply.
So that means there currently is no real way to create a tree structure with nodes which have children referenced?
This currently doesnt work