hi all,
i get this error in my code: "error C2678: binary '-' : no operator found which takes a left-hand operand of type 'const CSet<CDate>' (or there is no acceptable conversion) 275".
a little description:
i have a CDate class which represent dates.
i have a CSet class (template) which represents all kind of groups (set theory).
i have a Menu class that controls the program.
the problematic code:
1 2 3 4 5 6 7 8 9
template <class T>
bool CSet<T>::operator > (const CSet<T> &other) const
{
CSet<T> newGroup = (other - (*this));
if (newGroup.sizeOfArray == 0) // if A - B = (empty set) => A > B //
returntrue;
elsereturnfalse;
}
template <class T>
const CSet<T> CSet<T>::operator - (const CSet<T> &other)
{
CSet<T> newGroup;
if (generalArray)
{ // if this array is not empty //
newGroup = *this;
for (int i = ZERO; i < sizeOfArray; ++i)
{ // check if value is not in both arrays //
bool valueExists = false;
for (int j = ZERO; j < other.sizeOfArray; ++j)
{
if ((*generalArray[i]) == (*other.generalArray[j]))
{
valueExists = true;
break;
}
} // end of inner loop (j) //
if (valueExists) // if value is not in both arrays - copy to the new object //
newGroup -= (*generalArray[i]);
} // end of external loop (i) //
} // end of the condition - this array is not empty //
return newGroup;
}
i have tried that. the error message has gone, but now i am experiencing another problem:
in the - operator - when i return return newGroup , it returns nothing.
what can i do now?
edit: it works just fine. i didnt see that i had another problem in other function.
thanks!