How to return an invalid reference?

Yes, I know I can’t return the address of a local variable.
The problem is that I can’t instantiate an abstract class.
The only way to get an instance of the class is using this.(I think).
(I think it must be a static class, a singleton pattern or something like that)

ToSharedRef()

I was looking at how it was done.

And I was also looking at how the standard class works
https://en.cppreference.com/w/cpp/memory/shared_ptr

With the standard class you can return a null pointer like this.

std::shared_ptr (nullptr)

But this way doesn’t work with TSharedRef.

For now I think the easiest way is to simply return the pointer.

and then get the reference.

At least it saves me typing that monstrosity every time I want to get the pointer. :slight_smile:

Well, it’s a shame can’t be returned the reference directly from the function. Everything would have been more comfortable.

Thank you so much for your help!!
Really very much appreciated!! :heart: