ModularM
Modular2y ago
9 replies
toasty

Is it possible to store a list of References in Struct?

Calling all reference experts! I've seen some conversations lightly touching on the topic but I haven't seen anything concrete. I know I can do something like this:

struct CLI[is_mutable: Bool, lifetime: AnyLifetime[is_mutable].type]():
    var commands: List[Reference[Command, is_mutable, lifetime]]


But I can't actually add any references to the list, the lifetimes won't match. Is this something that's not possible in Mojo's current state?
Was this page helpful?