Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Operator= Overloading Already Declared?

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.

UCLASS() class UIHLCM : public UObject {



 int8 Priority;

 int8 Step;

 TArray<HLCMType> KillModifiers;

 HLCMType Type;


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"

FORCEINLINE UIHLCM& operator=(const UIHLCM &ihlcm) {

     Type = ihlcm.Type;
     // Other assignments go here

     return (*this);

If I'm overlooking something please let me know. I haven't found any documentation anywhere expressing that I can't do this.

I have been referring to this article: https://wiki.unrealengine.com/Operator_Overloads

EDIT: Resolved by sorting a list of pointers rather than objects.

Product Version: Not Selected
more ▼

asked May 10 '14 at 09:27 PM in C++ Programming

avatar image

18 3 4 9

avatar image Tim C ♦♦ STAFF May 12 '14 at 11:51 PM

Hi mattuyw. 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.


(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered May 13 '14 at 12:00 AM

avatar image

18 3 4 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Nov 18 '16 at 05:01 PM

avatar image

237 5 13 15

avatar image a409197988 Dec 25 '18 at 03:43 AM

Yes,you are right!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question