[Patch] fix compile kdecore with msvc

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sun Oct 30 16:35:17 GMT 2005

Hash: SHA1

Thiago Macieira schrieb:
> Christian Ehrlicher wrote:
>>>Your argument doesn't make sense. Functions that were not overridden
>>>will be inherited from QList<T>.
>>You're wrong. It's true for simple types but not for classes. Try to
>>compile this piece of code:
>>#include <QList>
>>struct testStruct {
>>	int iFirst;
>>	int iSecond;
> bool operator==(const testStruct&) const;
>>int main(int argc, char *argv[])
>>   QList<int> t1, t2;
>>   QList<testStruct> s1, s2;
>>   if ( t1 == t2 )
>>       qDebug("t1 == t2");
>>   if ( s1 == s2 )
>>       qDebug("s1 == s2");
>>	return 1;
>>gcc will fail here (so it's  not only the stupid msvc-compiler).
> By adding the line I showed above, it compiles.
Yes, this is clear.
> You cannot compare two structs unless they provide operator==.
> Since KResolverEntry doesn't, you cannot compare two KResolverResults.
> You're not supposed to, either, nor transform it into a set or vector.
But when you export the class, you have to provide a complete class
interface with all functions implemented...
> As for your toSet() test, did you include <QSet>? Because that's where
> QList<T>::toSet() is defined.
I've found a solution for this (see below)
> Anyways, removing the export macro from KResolverResults is out of the
> question. If you have a problem compiling, let's work out another
> solution.
Also I don't know why you won't remove the export macro, here is the
solution what you have to change so I can compile kresolver.cpp without
any problems. You just have to implement two functions:
bool KResolverEntry::operator ==(const KResolverEntry &) const;
inline uint qHash(KResolverEntry key);

With this the compiler can generate a complete class (imo including
QSet<KResolverEntry >).

Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the kde-core-devel mailing list