Hello, so i’m trying to call a getter function i have inside one of my strucs (MyStruct.h) from another class (AnotherClass.cpp) and getting this error when trying to compile:
Error ....\Game\AnotherClass.cpp(72) : error C3867: 'FMyStruct::GetValueInSlot': non-standard syntax; use '&' to create a pointer to member
Not directly related to your problem, but careful with “TArray<FMyStruct> SArr;”. The type you pass as template parameter must conform to some specification (see documentation about TArray) such as " Makes the assumption that your elements are relocate-able; i.e. that they can be transparently moved to new memory without a copy constructor.". Also if later you add attributes to this class, this may create performance issues or even runtime issues depending on their type. If in doubt, use pointers instead such as “TArray<FMyStruct*> SArr;”
the member function is named GetValueInSlot() but you are calling CurrentStruct.GetValInSlot()
the following code compiles fine under VS2017. It is syntaxically correct but as mentioned in 1. it may not be optimal.
Thank you very much for the reply, ill set up a pointer as the type template parameter, im quite new to c++ and UE4, would you mind explaining this function declaration?
what is the difference of that function declaration as opposed to this one? (is it just a default constructor declaration before the getter? if so, why?)