首页 > 解决方案 > 错误:'operator==' 不匹配(操作数类型为 'const C4::C4TrackKey' 和 'const C4::C4TrackKey')

问题描述

我似乎无法理解我收到的这个错误:

namespace C4
{
  struct STA
  {
    C4::C4TrackKey track_key;
    C4::C4TrackNumber  track_number;

  bool operator==(const STA &rhs) const
  {
    bool is_equal = false;
    if(this->track_key == rhs.track_key &&
       this->track_number == rhs.track_number)
    {
      is_equal = true;
    }
    return is_equal;
  };

错误:'operator==' 不匹配(操作数类型为 'const namespace::struct' 和 'const namespace::struct')

操作数类型相同,其他比较编译得很好。

标签: c++operator-overloading

解决方案


推荐阅读