Operator overloading on class templates

后端 未结 5 1591
孤城傲影
孤城傲影 2020-12-01 05:47

I\'m having some problems defining some operator overloads for template classes. Let\'s take this hypothetical class for example.

template 
cl         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 06:30

    You must specify that the friend is a template function:

    MyClass& operator+=<>(const MyClass& classObj);
    

    See this C++ FAQ Lite answer for details.

提交回复
热议问题