When declaring a TSharedPtr, is there a difference between having a class prefix (TSharedPtr<class Foo> Pointer; ) versus not having the prefix (TSharedPtr<Foo> Pointer; ) assuming a class Foo is valid and is included in the .h where I’m declaring the TSharedPtr? I can’t seem to figure out what to do when because half of my code works without the “class” prefix while the other half doesn’t.
The class prefix is just a forward declaration, the same as when you add the class MyClass; directly in your header. I prefer using forward declaration on the members because it is less messy. Adding the forward declaration will not hurt, it may even improve your build times or break reference cycles.
Okay, that’s great to know. Thanks for clearing that up for me as I struggled to find an answer in Unreal’s documentation.
You are welcome