[Patch] fix compile kdecore with msvc

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


-----BEGIN PGP SIGNED MESSAGE-----
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:
>>
>>--------------------8<------------------
>>#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;
>>}
>>--------------------8<------------------
>>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;
and
inline uint qHash(KResolverEntry key);

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

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

iD8DBQFDZPZFnNKwkgf+zVMRAnK0AKCBo7uxv/KzIOhNoHkIIneb6yMdVwCfZxeo
JyEtC+tCtSfVkkwiNB0aOX4=
=mMH2
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list