Re: [Interest] QString operator==

2012-08-22 Thread Thiago Macieira
On quarta-feira, 22 de agosto de 2012 13.35.19, André Somers wrote:
 Hmmm... Wouldn't it make sense to also check on the the d pointers
 actually being the same? Or is that in qMemEquals?

Hint: please check before asking. Takes a couple of seconds...

static bool qMemEquals(const quint16 *a, const quint16 *b, int length)
{
if (a == b || !length)
return true;

[...]

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
 Intel Sweden AB - Registration Number: 556189-6027
 Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden


signature.asc
Description: This is a digitally signed message part.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QString operator==

2012-08-22 Thread André Somers
Op 22-8-2012 13:40, Thiago Macieira schreef:
 On quarta-feira, 22 de agosto de 2012 13.35.19, André Somers wrote:
 Hmmm... Wouldn't it make sense to also check on the the d pointers
 actually being the same? Or is that in qMemEquals?
 Hint: please check before asking. Takes a couple of seconds...

 static bool qMemEquals(const quint16 *a, const quint16 *b, int length)
 {
  if (a == b || !length)
  return true;

Yes, you are right of course. I could have checked it online, for a lack 
of having the Qt sources at hand.

André
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QString operator==

2012-08-21 Thread Giuseppe D'Angelo
On 21 August 2012 12:09, Thomas Meyer pub...@meyer-thomas.com wrote:
 Hi,
 I can't find the definition for
 ...
 bool operator==(const QString s) const;
 ...
 in QString (.h, line 403, Qt v4.8.2 (MS Windows 7)).

http://qt.gitorious.org/qt/qt/blobs/4.8/src/corelib/tools/qstring.cpp#line2181

-- 
Giuseppe D'Angelo
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QString operator==

2012-08-21 Thread Bo Thorsen
Den 21-08-2012 13:09, Thomas Meyer skrev:
 Hi,
 I can't find the definition for
 ...
 booloperator==(constQStrings)const;
 ...
 in QString (.h, line 403, Qt v4.8.2 (MS Windows 7)).

 I only found it for QLatinString and QByteArray:
 (Where is the declaration for QByteArray?)
 ...
 inlineboolQByteArray::operator==(constQStrings)const
 {returnqStringComparisonHelper(s,constData());}
 ...

 Please can somebody help me?

It's in qstring.cpp:

bool QString::operator==(const QString other) const
{
 if (d-size != other.d-size)
 return false;

 return qMemEquals(d-data, other.d-data, d-size);
}

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest