My issue stems from accomidating the Swap( T& A, T& B ) method in UnrealTemplate.h so that I can take advantage of sorting a list of my UObject type. Otherwise the compiler complains that it “cannot access private member declared in class ___”. Which is odd, because all variables are public. I eventually chalked it up to probably being a complaint about the array. Here are the relevant data types.
I have already overloaded operator== but when I tried to overload the assignment operator in the following way, it complains that “error C2535: ‘UIHLCM &UIHLCM::operator =(const UIHLCM &)’ : member function already defined or declared”
Hi . If you were able to resolve the issue you were experiencing, would you mind posting what you did as an answer to this question? There may be others who are having the same issue, or a similar one, who would benefit from knowing how you were able to get it to work for you.
Update: I tracked the Swap() error down to the probable cause of either variables or methods in UObject not having explicitly defined privacy declarations. The solution was to change the list I was sorting to a list of pointers which can be freely remapped by the Swap() method. I am still unable to overload the assignment operator, but good news is that there are ways around it.
I had the same issue regarding assignment operators. It turns out that GENERATED_BODY() does only declare these operators, but does not implement them if they are present already.
My solution (which I haven’t tested thoroughly though) was to just implement the operators in the .cpp file, but not to declare them in the header.