[Development] QStringRef conversion functions

Thiago Macieira thiago.macieira at intel.com
Wed Jun 13 20:36:52 CEST 2012


On quarta-feira, 13 de junho de 2012 18.14.59, aaron.kennedy at nokia.com wrote:
> Won't a QString always require an allocation for the d-ptr?  So it'll never
> be quite as cheap as QStringRef.

Not exactly.

A QStringRef points to an existing QString. Therefore, if we take a QString 
that is pointing to a substring of an existing QString, the d-ptr is already 
allocated. The new QString would be as cheap as the current QStringRef.

The issue we'll run into is that a substring could be "holding hostage" a huge 
chunk of memory.

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120613/37676129/attachment.sig>


More information about the Development mailing list