www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - template stuff

reply "Robert M. Münch" <robert.muench robertmuench.de> writes:
Hi, I have the following code from an include file:

template <class Type>
int DArrayAsVector<Type>::operator==(const DArrayAsVector<Type>& other)
{   if (count != other.count)
        return false;
    for (int i = 0; i < count; ++i)
        if (!(get(i) == other.get(i)))
            return false;
    return true;
}

And I get this error message:

d:\develop\dtsearch\include\darray.h(189) : Error: illegal operand types
Had: CUserThesaurusItem
and: CUserThesaurusItem

The template code look syntactically correct to me. But I really don't have
a clue what the error might be. Further I didn't found any instantiation of
the template with CUserThesaurusItem somewhere in the list file...

Any idea what the problem could be?

--
Robert M. Münch
IT & Management Freelancer
Mobile: +49 (0)177 2452 802
Fax   : +49 (0)721 8408 9112
Web   : http://www.robertmuench.de
Nov 20 2002
parent Jan Knepper <jan smartsoft.us> writes:
To me it looks like your CUserThesaurusItem or whatever the 'get' member
returns is missing an operator.
bool   operator == ( const CUserThesaurusItem & ) const;
(or the ~const version).

Jan



"Robert M. Münch" wrote:

 Hi, I have the following code from an include file:

 template <class Type>
 int DArrayAsVector<Type>::operator==(const DArrayAsVector<Type>& other)
 {   if (count != other.count)
         return false;
     for (int i = 0; i < count; ++i)
         if (!(get(i) == other.get(i)))
             return false;
     return true;
 }

 And I get this error message:

 d:\develop\dtsearch\include\darray.h(189) : Error: illegal operand types
 Had: CUserThesaurusItem
 and: CUserThesaurusItem

 The template code look syntactically correct to me. But I really don't have
 a clue what the error might be. Further I didn't found any instantiation of
 the template with CUserThesaurusItem somewhere in the list file...

 Any idea what the problem could be?
Nov 20 2002