ModularM
Modular2y ago
4 replies
swig.

Defining A DynamicVector containing References

I am trying to create a vector that holds a list of object references so that I can manipulate the object's properties from the container but I don't understand how to define the "lifetime" of the Reference type. According to the Mojo docs, it requires three parameters (Reference[?, ?, ?]). I want the lifetime to last for the duration of the parent object's lifetime. Can I get some examples for proper lifetime values when specifying the Reference type parameters?
Reference[Snake, __mlir_attr.`true`, ImmLifetime.DType]
Was this page helpful?