ModularM
Modular2y ago
14 replies
Martin Dudek

What UnsafePointer can point to and allocate mem for?

I opened an issue last week in which I reported a problem with allocating for an array of Sets

https://github.com/modularml/mojo/issues/2503

This issue was closed as not planned'which leaves me confused right now,. From the docu it says

UnsafePointer is a pointer type that can point to any generic value that is movable.

and Set in this example seems to be an appropriate object to point to.

As usual, I guess there is a fundamental misunderstanding here on my side and I wonder if anybody can explain to me, what Unsafepointer can point to and allocate memory for. The docu says

T (AnyType): The type the pointer points to.

but Set comfirms with AnyType of course ... Thx
GitHub
Bug description the following code crashes: from collections import Set @value struct IDStruct(KeyElement): var id: Int fn eq(self, other: Self) -> Bool: return self.id == other.id fn ne...
[BUG] Accessing allocated memory for an array of sets crashes · Iss...
Was this page helpful?