Shared pointers are non-intrusive which means the class itself does not know whether it is owned by a shared pointer (or reference). In general, this is okay, but sometimes you really want to access the current instance as a shared reference. The solution to this is to derive the class from
By deriving from
TSharedFromThis<>, you can use the AsSharedRef() method to convert 'this' to a shared reference. This can be very useful with class factories that always return shared references.
class FAnimation : public TSharedFromThis<FMyClass>
// Access a shared reference to 'this'
TSharedRef<FMyClass> SharedThis = AsSharedRef();
// Class a function that is expecting a shared reference
AnimationSystem::RegisterAnimation( SharedThis );