• 6949阅读
  • 2回复

QList 和 operator==重载 [复制链接]

上一主题 下一主题
离线sophister
 
只看楼主 倒序阅读 楼主  发表于: 2009-04-06
昨天写一个类,用到了QList, 在用QList::removeOne(const T &t)的时候总是是报错:

error: no match for 'operator==' in 'n->QList<T>::Node::t [with T = User]() == t'

于是给相应的类T加上了重载运算符operator==(),可是仍然报错,希望高手指点一下!!
谢谢!!
离线foxyz

只看该作者 1楼 发表于: 2009-04-07
贴出错误先
离线wxyao

只看该作者 2楼 发表于: 2009-12-17
怎么解决的呢? 期待ing
bool QList::contains ( const T & value ) const 的文档如下:


Returns true if the list contains an occurrence of value; otherwise returns false.

This function requires the value type to have an implementation of operator==().

See also indexOf() and count().


请教各位,如何重载QList运算符
快速回复
限100 字节
 
上一个 下一个