error: no match for 'operator=' in '*(xxxx*)n = t'

qList中使用自定义类型时,如果使用append函数需要重载 operator= 运算符

例如:

public:

CScpiExecuteCommand& operator=( const CScpiExecuteCommand &cmd )
{

xx = cmd.xx

return *this;

}

如果丢掉了 const  会出现 error: no match for 'operator=' in '*(scpi_parse::CScpiExecuteCommand*)n = t'错误

因为在qlist.h中会调用

Q_INLINE_TEMPLATE void QList::node_construct(Node *n, const T &t)

转载于:https://www.cnblogs.com/fanfan1108/p/7219081.html

你可能感兴趣的:(error: no match for 'operator=' in '*(xxxx*)n = t')