March 2019
Intermediate to advanced
708 pages
17h 9m
English
We can demonstrate the use of the four types of smart pointers referred to previously using a short code segment. In all of this code, the starting pointer can either be a raw pointer, or a copy of another smart pointer. All you have to do is take the C++ raw pointer and wrap it in a constructor call to any of the following: TSharedPtr, TSharedRef, TWeakPtr,, or TAutoPtr.
For example, take a look at the following code snippet:
// C++ Class NOT deriving from UObject
class MyClass { };
TSharedPtr<MyClass>sharedPtr( new MyClass() );
Read now
Unlock full access