#Why does "->" operator works on TSharedRef

1 messages · Page 1 of 1 (latest)

sleek halo
#

Why does -> operator works on TSharedRef?

#

typedef TSharedRef<IHttpRequest, ESPMode::ThreadSafe> FHttpRequestRef

tepid breach
#

because it has the operator implemented to get the wrapped ptr?

#

smth like

class Foo
{
  public:
    Bar* operator->() const { return MyBar; }
  private:
    Bar* MyBar{nullptr};
};
sleek halo
#

So are you saying that shared references are not actually references?

tepid breach
#

a shared reference is a sharedptr that can't wrap a nullptr

sleek halo
#

Bruh.

forest bone
#

you can name the type as you want

#

and any type can have operator overloads

sleek halo
narrow saddle