short question, for some reason I can't figure this out...
I have a
maxon::PointerArray<MyClass>, and I need to remove one of the elements, but without freeing the pointed object (instead, I'll add it to another PointerArray later). I believe,
PointerArray::ErasePtr() is the correct function for this, but I can't get rid of the compile errors.
maxon::PointerArray<MyClass> array; // Array is filled with objects // This is done as described in the SDK docs: MyClass* newObjPtr = NewObj(MyClass) iferr_return; maxon::UniqueRef<MyClass> newObjRef = newObjPtr; array.AppendPtr(newObjRef) iferr_return; newObjRef.Disconnect(); // Remove an element from the array, so the array gives up the ownership, but the object still exists // This obviously not working. MyClass* formerElemPtr = nullptr; array.ErasePtr(index, *formerElemPtr) iferr_return;
All I want is the element to vanish from the array, but I still need a valid pointer to it. What's the correct way to do this?
Thanks in advance.