yellowmat
16th June 2006, 09:48
Hi !
I have a compilation error whilie trying to use the operator == of a QValueList and I don't know why.
Here is the problem :
I have a simple class named CClassA which has :
* a default constructor
* a copy constructor
* an operator =
* an operator ==
I did compile and test the code of this class and everything is good.
I have another class named CClassB which has the same kind of constructors and operators, but it also has a member declared as follow :
QValueList<CClassA> m_vlListOfClassA;
My problem is in the operator== of CClassB where I have the following code :
if( m_vlListOfClassA == ra.m_vlListOfClassA )
return true;
else
return false;
It seems good to me but the compilation always fails and send the following message :
c:\qt\3.3.3\include\qvaluelist.h(582) : error C2678: binary '==' : no operator defined which takes a left-hand operand of type 'const class CClassA' (or there is no acceptable conversion)
c:\qt\3.3.3\include\qmap.h(240) : while compiling class-template member function 'bool __thiscall QValueList<class CClassA>::operator ==(const class QValueList<class CClassA> &) const'
What should I do in my operator== to check if both list content are equal if it is not possible to use the QValueList operator== ? Should I check every objet of boths lists ?
Thanks in advance.
I have a compilation error whilie trying to use the operator == of a QValueList and I don't know why.
Here is the problem :
I have a simple class named CClassA which has :
* a default constructor
* a copy constructor
* an operator =
* an operator ==
I did compile and test the code of this class and everything is good.
I have another class named CClassB which has the same kind of constructors and operators, but it also has a member declared as follow :
QValueList<CClassA> m_vlListOfClassA;
My problem is in the operator== of CClassB where I have the following code :
if( m_vlListOfClassA == ra.m_vlListOfClassA )
return true;
else
return false;
It seems good to me but the compilation always fails and send the following message :
c:\qt\3.3.3\include\qvaluelist.h(582) : error C2678: binary '==' : no operator defined which takes a left-hand operand of type 'const class CClassA' (or there is no acceptable conversion)
c:\qt\3.3.3\include\qmap.h(240) : while compiling class-template member function 'bool __thiscall QValueList<class CClassA>::operator ==(const class QValueList<class CClassA> &) const'
What should I do in my operator== to check if both list content are equal if it is not possible to use the QValueList operator== ? Should I check every objet of boths lists ?
Thanks in advance.