No match for
时间: 2023-08-11 21:04:30 浏览: 135
无
引用\[1\]中的错误提示"no match for 'operator=='"通常是因为在自定义数据类型中没有重载"=="运算符导致的。解决方法是在对应的自定义数据类型中重载"=="运算符,例如在类Dog中重载"=="运算符,示例代码如下:
```cpp
class Dog {
public:
Dog();
~Dog();
QString m_sName;
QString m_sAge;
bool operator==(const Dog &other) const {
return (m_sName == other.m_sName || m_sAge == other.m_sAge);
}
};
```
引用\[2\]中的错误是因为在语句`cout << a + b << endl;`中,a + b是一个右值,而operator++函数的参数a没有使用const进行修饰,无法与作为右值的a + b进行成功绑定,导致编译错误。
引用\[3\]中提到,R-value指的是可读的值,即在计算机语言中没有地址的值。左值引用和右值引用是与R-value相关的概念。
综上所述,根据引用\[1\]和引用\[2\]的内容,可以推断出问题的完整内容是"No match for 'operator=='"。
#### 引用[.reference_title]
- *1* [Qt报错:no match for ‘operator==‘ (operand types are ‘xxx‘ and ‘const xxx‘)](https://blog.csdn.net/ShenY_/article/details/129103637)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [[错误分析][Error]no match for ‘operator‘无匹配的左移运算符](https://blog.csdn.net/qq_35630119/article/details/117638274)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文