[Development] QStringRef conversion functions
aaron.kennedy at nokia.com
aaron.kennedy at nokia.com
Wed Jun 13 20:44:41 CEST 2012
Hi,
On 13/06/2012, at 7:36 PM, ext Thiago Macieira wrote:
> 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.
How does that work? Where do you store the substring's offset and length data?
Cheers,
Aaron
>
> 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
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
More information about the Development
mailing list