November 20, 2002 template stuff | ||||
---|---|---|---|---|
| ||||
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 |
November 20, 2002 Re: template stuff | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert M. Münch | 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?
|
Copyright © 1999-2021 by the D Language Foundation