[email protected]
[Top] [All Lists]

Re: QUuid::operator<(QUuid&) broken?

Subject: Re: QUuid::operator<(QUuid&) broken?
From: Andreas Pakulat
Date: Wed, 12 Apr 2006 11:39:52 +0200
On 12.04.06 10:23:08, Daniel Oberhoff wrote:
> Hmm, yes, I didn't look sharp enough, sorry. One of the ids has to be the
> default id, which is all '0', and the other a random one created with
> QUuid::makeUuid() (in your test both are default). Or one has to be a
> custom id like 0000000000000000000000001 or 000000000000000000002. Thus
> having a default id and/or any custom ids and else regular random ids map
> will assume that they are all equal to the default id or one of the custom
> ids and never insert any of the random ids.

This is documented behaviour, see operator> for QUuid. It says there
that the 2 QUuids need to be of the same variant and are then compared
lexicographically. In the docs for variant() it clearly states that the
null Uuid (the default value) is of unkown variant.

I think your problem is that your create Uuids like
"000000000000000000001", which probably is of a different variant than
the ones from createUuid, so the solution would be: Only use QUuids as
keys in a QMap that are from the same variant.


You will have long and healthy life.

To unsubscribe - send a mail to [email protected] with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>