Announcement

Collapse
No announcement yet.

TSharedPtr<> Class Prefix

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TSharedPtr<> Class Prefix

    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.
    Last edited by ProlixLegend; 01-03-2015, 07:57 PM.
    2B || (!2B)

    #2
    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.
    Sr. Engine Programmer @ www.playspace.com - moritzwundke.com
    Remember: be polite and respect other peoples opinions - Join the Unofficial Unreal Discord Channel - Found a bug? Then use the Bug Report Form to get it fixed ^^

    Comment


      #3
      Okay, that's great to know. Thanks for clearing that up for me as I struggled to find an answer in Unreal's documentation.
      2B || (!2B)

      Comment


        #4
        You are welcome
        Sr. Engine Programmer @ www.playspace.com - moritzwundke.com
        Remember: be polite and respect other peoples opinions - Join the Unofficial Unreal Discord Channel - Found a bug? Then use the Bug Report Form to get it fixed ^^

        Comment

        Working...
        X